B
boku
Guys
I'm trying to write a utilty that can search class name from jar/war/ear.
Sometime, I see an ear file that has several war files which has some jars in
it. I thougth I could write a recurive function, but I don't know how to get the
list from the nested jar.
Any suggestion?
Here is the part of function I'm writing.
public static void findInArchive(String searchingString, File archiveName) {
FileInputStream fis = new FileInputStream(archiveName);
ZipInputStream zis = new ZipInputStream(new BufferedInputStream(fis));
ZipEntry entry = null;
String pathName, fileName;
while ((entry = zis.getNextEntry()) != null) {
pathName = entry.getName();
fileName = pathName.substring(pathName.lastIndexOf('/')+1);
if (pathName.endsWith(".jar") || pathName.endsWith(".zip") ||
pathName.endsWith(".war") || pathName.endsWith(".ear")) {
findInArchive(); // Not sure what to do here
}
// search for the matching string on the list of archive...
}
}
I'm trying to write a utilty that can search class name from jar/war/ear.
Sometime, I see an ear file that has several war files which has some jars in
it. I thougth I could write a recurive function, but I don't know how to get the
list from the nested jar.
Any suggestion?
Here is the part of function I'm writing.
public static void findInArchive(String searchingString, File archiveName) {
FileInputStream fis = new FileInputStream(archiveName);
ZipInputStream zis = new ZipInputStream(new BufferedInputStream(fis));
ZipEntry entry = null;
String pathName, fileName;
while ((entry = zis.getNextEntry()) != null) {
pathName = entry.getName();
fileName = pathName.substring(pathName.lastIndexOf('/')+1);
if (pathName.endsWith(".jar") || pathName.endsWith(".zip") ||
pathName.endsWith(".war") || pathName.endsWith(".ear")) {
findInArchive(); // Not sure what to do here
}
// search for the matching string on the list of archive...
}
}