我有一个包含耳内文件的zip文件。在ear文件中和jar文件夹中的文件夹。
最后,在jar文件中是一个xml。读取xml不是问题,问题是在不解压缩任何内容的情况下获取xml文件。
我设法进入了耳朵文件,但没有别的
public ZipInputStream inner(ZipFile zf, ZipEntry ze) {
InputStream innerZipStream;
ZipInputStream innerZis = null;
try {
innerZipStream = zf.getInputStream(ze);
innerZis = new ZipInputStream(innerZipStream);
} catch (IOException ex) {
Logger.getLogger(Dependencias.class.getName()).log(Level.SEVERE, null, ex);
}
return innerZis;
} public String gEar(ZipFile zip) throws IOException {
String earName = null;
extreureDades(zip.getName());
try {
ZipInputStream zis = new ZipInputStream(new FileInputStream(ruta + File.separator + zip.getName()));
ZipEntry entry;
while (null != (entry = zis.getNextEntry())) {
System.out.println(entry.getName());
if (entry.getName().endsWith(".ear")) {
ZipInputStream zisEar = inner(zip, entry);
ZipEntry entryEar;
while (null != (entryEar = zisEar.getNextEntry())) {
System.out.println("-----------" + entryEar.getName());
if (entryEar.getName().contains("META-INF/")) {
} else if (entryEar.getName().contains("lib/")) {
if (entryEar.getName().endsWith(".jar")) {
}
}
}
}
zis.closeEntry();
}
} catch (FileNotFoundException ex) {
Logger.getLogger(Dependencias.class.getName()).log(Level.SEVERE, null, ex);
}
return earName;
}