Last active
December 9, 2016 14:12
-
-
Save icshih/af5ccabbd4459c4b63248b2e308e5a9f to your computer and use it in GitHub Desktop.
Visiting a zip archive
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void visitArchive(String zipFile) { | |
URI zipUri = URI.create("jar:file:" + zipFile); | |
try (FileSystem zipfs = FileSystems.newFileSystem(zipUri, new HashMap<>())) { | |
Files.walkFileTree(zipfs.getPath("/"), new SimpleFileVisitor<Path>() { | |
@Override | |
public FileVisitResult visitFile( Path file, BasicFileAttributes attrs ) throws IOException { | |
// visiting inside the archive | |
return FileVisitResult.CONTINUE; | |
} | |
}); | |
} catch (IOException e) { | |
System.out.println("Unable to open the compressed file, " + e); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment