Zip files in Java 7 can be treated similarly like file system:
http://fahdshariff.blogspot.cz/2011/08/java-7-working-with-zip-files.html
In my project I'd like to process the zip file stored in resources. But I cannot find any efficient way for converting the resource stream (getResourceAsStream) into a new FileSystems object directly without storing that file to the disk first:
Map<String, String> nameMap = new HashMap<>();
Path path = Files.createTempFile(null, ".zip");
Files.copy(MyClass.class.getResourceAsStream("/data.zip"), path, StandardCopyOption.REPLACE_EXISTING);
try (FileSystem zipFileSystem = FileSystems.newFileSystem(path, null)) {
Files.walkFileTree(zipFileSystem.getPath("/"), new NameMapParser(nameMap));
}
Files.delete(path);
Am I missing something?