I'm trying to use a file selector (which is only allowed to select zips) to give me that File and then I will perform another method on every separate File in the zip. However, I'm struggling with the compiler as it is expected generic Files rather than zipFiles. I'm trying to use this example : the marked answer on this post
File zipFile = zfc.getSelectedFile();
ZipInputStream zis;
try {
zis = new ZipInputStream(new FileInputStream(zipFile));
ZipEntry ze;
ze = zis.getNextEntry();
while (ze != null) {
InputStream stream = ((ZipFile) zipFile)
.getInputStream(ze);
//method here that will operate on stream
ze = zis.getNextEntry();
}
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Basically how can I read a File from a zip in java or how do I change a zipEntry to a File.