Java URL Value Check isLocalURL(URL url)

Here you can find the source of isLocalURL(URL url)

Description

is Local URL

License

Open Source License

Declaration

public static boolean isLocalURL(URL url) 

Method Source Code

//package com.java2s;
/**//w  ww .  ja  v  a 2  s  .  c  o  m
 * Copyright (c) 2006-2010, Cloudsmith Inc.
 * The code, documentation and other materials contained herein have been
 * licensed under the Eclipse Public License - v 1.0 by the copyright holder
 * listed above, as the Initial Contributor under such license. The text of
 * such license is available at www.eclipse.org.
 */

import java.net.URL;

public class Main {
    public static boolean isLocalURL(URL url) {
        String proto = url.getProtocol();
        if (proto.equals("jar") || proto.equals("reference")) //$NON-NLS-1$ //$NON-NLS-2$
        {
            String spec = url.getFile();
            int sepIdx = spec.indexOf(':');
            if (sepIdx == -1)
                return false;
            proto = spec.substring(0, sepIdx);
        }
        return "file".equals(proto) || "platform".equals(proto) || proto.startsWith("bundle"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    }
}

Related

  1. isLocalFile(URL url)
  2. isLocalFile(URL url)
  3. isLocalFile(URL url)
  4. isLocalhost(URL url)
  5. isLocalURL(String s)
  6. isLocalURL(URL url)
  7. isNewer(URL file, URL reference)
  8. isResponseCode(String url, int expectedCode)
  9. isResponsive(URL url)