I've been trying to replace a file in zip without extracting the zip. I tried using the most efficient answer here: https://stackoverflow.com/a/17504151/3397618
I'll paste the code below for reference however.
Map<String, String> env = new HashMap<>();
env.put("create", "true");
Path path = Paths.get("test.zip");
URI uri = URI.create("jar:" + path.toUri());
try (FileSystem fs = FileSystems.newFileSystem(uri, env))
{
Path nf = fs.getPath("new.txt");
try (Writer writer = Files.newBufferedWriter(nf, StandardCharsets.UTF_8, StandardOpenOption.CREATE)) {
writer.write("hello");
}
}
Android Studio throws an error saying: error: cannot find symbol variable Paths, error: cannot find symbol method toUri(), error: cannot find symbol class FileSystem, error: cannot find symbol variable FileSystems.
Is it that android doesn't support Java 7 entirely?? Or do I need to do something to get it working?