Paths class looks up paths in the default file system—the files on the user’s local disk. You can have other file systems. One of the more useful ones is a ZIP file system. If
zipname is the name of a ZIP file, then the call
FileSystem fs = FileSystems.newFileSystem(Paths.get(zipname), null);
establishes a file system that contains all files in the ZIP archive. It’s an easy matter to copy a file out of that archive if you know its name:
fs.getPath is the analog of
Paths.get for an arbitrary file system.
To list all files in a ZIP archive, walk the file tree:
FileSystem fs = FileSystems.newFileSystem(Paths.get(zipname), null); Files.walkFileTree(fs.getPath("/"), ...