Enumeration entriesEnum = archive.entries();
while(entriesEnum.hasMoreElements()) {
String entry = (String) entriesEnum.nextElement();
if (entry.endsWith(".class")) {
File file = null;
int ind = entry.lastIndexOf("/");
if (ind != -1) {
String entryName = entry.substring(ind + 1);
String parent = archive.getArchiveUri() + File.separatorChar +
entry.substring(0, ind);
file = new File(parent.replace('/", File.separatorChar), entryName);
} else {
file = new File(archive.getArchiveUri(), entry);
}
// check if it contains top level annotations...
InputStream is = null;
try {
is =
new BufferedInputStream(new FileInputStream(file));
ReadableByteChannel channel = Channels.newChannel(is);
if (channel!=null) {
if (classFile.containsAnnotation(channel, file.length())) {
return true;
}
}
} finally {
if (is != null) {
is.close();
}
}
}
}
return false;