How to check that file exists inside a zip archive?
For example, check whether app.apk
contains classes.dex
.
I want to find a solution that uses Java NIO.2 Path
and without extracting the whole archive if possible.
I've tried and it didn't work:
Path classesFile = Paths.get("app.apk", "classes.dex"); // apk file with classes.dex
if (Files.exists(apkFile)) // false!
...
My solution is:
Path apkFile = Paths.get("app.apk");
FileSystem fs = FileSystems.newFileSystem(apkFile, null);
Path dexFile = fs.getPath("classes.dex");
if (Files.exists(dexFile))
...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With