Java URL is Absolute isAbsolute(String uri)

Here you can find the source of isAbsolute(String uri)

Description

is Absolute

License

Open Source License

Declaration

public static boolean isAbsolute(String uri) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2004, 2007 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:/*  w  w w  .j  ava 2 s.c  om*/
 * IBM Corporation - initial API and implementation
 * yyyymmdd bug      Email and other contact information
 * -------- -------- -----------------------------------------------------------
 *     IBM Corporation - Initial API and implementation
 *     Jens Lukowski/Innoopract - initial renaming/restructuring
 * 20071205   211262 ericdp@ca.ibm.com - Eric Peters, CopyWSDLTreeCommand fails to copy ?wsdl
 *******************************************************************************/

public class Main {
    protected static final String PROTOCOL_PATTERN = ":";

    public static boolean isAbsolute(String uri) {
        boolean result = false;
        if (uri != null) {
            int index = uri.indexOf(PROTOCOL_PATTERN);
            if (index != -1 || uri.startsWith("/") || uri.startsWith("\\")) {
                result = true;
            }
        }
        return result;
    }
}

Related

  1. getAbsoluteUrl(URL baseUrl, String relativeUrl)
  2. getAbsoluteUrlFromFile(final String file)
  3. getAbsoluteUrlPathFromFile(String file)
  4. isAbsolute(String uri)
  5. isAbsolute(String uri)
  6. isAbsoluteUri(String s)
  7. isAbsoluteURI(String source)
  8. isAbsoluteURI(String uri)
  9. isAbsoluteURI(String uri)