Get the next ClassFile object from the jar
ZipEntry jarEntry;
ClassFile nextElement = null;
try {
jarEntry = jarStream.getNextEntry();
while (nextElement == null && jarEntry != null) {
String entryName = jarEntry.getName();
if (!jarEntry.isDirectory() && entryName.endsWith(".class")) {
// create a data input stream from the jar input stream
ClassFile javaClass = new ClassFile();
javaClass.read(jarStream);
nextElement = javaClass;
} else {
jarEntry = jarStream.getNextEntry();
}
}
} catch (IOException e) {
String message = e.getMessage();
String text = e.getClass().getName();
if (message != null) {
text += ": " + message;
}
throw new RuntimeException("Problem reading JAR file: " + text);
}
return nextElement;