Java URL Connection isJarDirectory(JarURLConnection conn)

Here you can find the source of isJarDirectory(JarURLConnection conn)

Description

is Jar Directory

License

Open Source License

Declaration

public static boolean isJarDirectory(JarURLConnection conn) throws IOException 

Method Source Code

//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 + "/";
    }
}

Related

  1. getURLStream(URL url, int level)
  2. getWebPageHtmlContent(String url)
  3. getWebsiteContents(URL url)
  4. httpPost(String urlString, String postPath, Map keyValuePairs)
  5. imageFromUrl(String url)
  6. isOnline(String url)
  7. isUrlReachable(String url)
  8. isValidToc(URL url)
  9. isValidUrl(String input)