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

static boolean isAbsolute(String uri) 

Method Source Code

//package com.java2s;
/* Copyright 2004-2006, 2009 Elliotte Rusty Harold
       //from www  .ja  v a 2s. c  om
   This library is free software; you can redistribute it and/or modify
   it under the terms of version 2.1 of the GNU Lesser General Public 
   License as published by the Free Software Foundation.
       
   This library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
   GNU Lesser General Public License for more details.
       
   You should have received a copy of the GNU Lesser General Public
   License along with this library; if not, write to the 
   Free Software Foundation, Inc., 59 Temple Place, Suite 330, 
   Boston, MA 02111-1307  USA
       
   You can contact Elliotte Rusty Harold by sending e-mail to
   elharo@metalab.unc.edu. Please include the word "XOM" in the
   subject line. The XOM home page is located at http://www.xom.nu/
*/

public class Main {
    static boolean isAbsolute(String uri) {

        int colon = uri.indexOf(':');
        if (colon < 1)
            return false;
        // We assume the URI has already been verified as a potentially 
        // legal URI. Thus we don't have to check everything here.
        /*if (!Verifier.isAlpha(uri.charAt(0))) return false;
        for (int i = 1; i < colon; i++) {
         if (!Verifier.isSchemeCharacter(uri.charAt(i))) return false;
        } */
        return true;

    }
}

Related

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