Here you can find the source of isJarDirectory(JarURLConnection conn)
public static boolean isJarDirectory(JarURLConnection conn) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.IOException; import java.net.JarURLConnection; import java.util.jar.JarFile; import java.util.zip.ZipEntry; public class Main { public static boolean isJarDirectory(JarURLConnection conn) throws IOException { JarFile jarFile = conn.getJarFile(); String entryName = conn.getEntryName(); ZipEntry dirEntry = jarFile.getEntry(addEndingSlash(entryName)); return dirEntry != null && dirEntry.isDirectory(); }/*from w ww . j a va2 s. com*/ private static String addEndingSlash(String path) { return path.endsWith("/") ? path : path + "/"; } }