Java Utililty Methods Jar Entry

List of utility methods to do Jar Entry

Description

The list of methods to do Jar Entry are organized into topic(s).

Method

StringconstructClassName(JarEntry je)
construct Class Name
int n = je.getName().length() - ".class".length();
return je.getName().replace("/", ".").substring(0, n);
JarEntrygetJarEntry(JarFile file, String entryName)
Find the specified entry in the specified JAR file
return file.getJarEntry(entryName);
booleanhasClassEntry(JarFile jarFile, String className)
has Class Entry
String path = className.replace('.', '/') + ".class";
return jarFile.getEntry(path) != null;
booleaninClasspath(Collection classpath, JarEntry entry)
in Classpath
for (String s : classpath) {
    if (entry.getName().startsWith(s)) {
        return true;
return false;
booleanisJavaClass(JarEntry je)
is Java Class
return je.getName().endsWith(".class");
booleanisJavaLibrary(JarEntry entry)
is Java Library
return entry.getName().toLowerCase().endsWith(".jar") || entry.getName().toLowerCase().endsWith(".zip");
booleanisNativeLibrary(JarEntry entry)
is Native Library
String name = entry.getName();
int dotSeperatorPosition = name.lastIndexOf('.');
if (dotSeperatorPosition <= 0) {
    return false;
String type = name.substring(dotSeperatorPosition + 1);
if (NATIVE_LIB_FILE_TYPES.contains(type)) {
    return true;
...
StringparseSimpleName(JarEntry entry)
Returns the name of a JAR or ZIP entry without the path.
int index = entry.getName().lastIndexOf("/");
String simpleName;
if (index > 0) {
    simpleName = entry.getName().substring(index);
} else {
    simpleName = entry.getName();
if (!simpleName.endsWith(".jar") && !simpleName.endsWith(".zip")) { 
...
StringtrimEntryName(JarEntry je)
trim Entry Name
String[] s = je.getName().toLowerCase().replace(".htm", "").split("/");
return s[s.length - 1];