I want to return boolean to check if my zip file is compressed . Will be an advantage if i can also get what Compression method has been used. For now I am just checking is it is Encrypted and is valid zip. Please help if it is possible using zip4j library.
public static boolean isPackageCompressed(String path) throws ZipException{
boolean isPackageCompressed = false;
ZipFile zipFile = new ZipFile(path);
System.out.println(zipFile.isEncrypted());
System.out.println(zipFile.isValidZipFile());
// TODO. There is no method like zipFile.getCompressionMethod() .
return isPackageCompressed;
}
public static void main(String[] args) {
try {
isPackageCompressed("D:\\some.ZIP");
} catch (ZipException e) {
e.printStackTrace();
}
}