Java URL is Absolute isAbsoluteURL(String str)

Here you can find the source of isAbsoluteURL(String str)

Description

Check if the given url string is the absolute URL starting with / and without protocol nor host portion

License

Open Source License

Declaration

static public boolean isAbsoluteURL(String str) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2005-2011 eBay Inc.//from  w  ww  .  j a va 2 s . co m
 * 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
 *
 *******************************************************************************/

public class Main {
    /**
     * Check if the given url string is the absolute URL starting with
     * <code>/<code> and without protocol nor host portion
     */
    static public boolean isAbsoluteURL(String str) {
        return (str.startsWith("/") && !str.startsWith("//"));
    }
}

Related

  1. isAbsoluteURI(String source)
  2. isAbsoluteURI(String uri)
  3. isAbsoluteURI(String uri)
  4. isAbsoluteUrl(String imageUrl)
  5. isAbsoluteUrl(String ref)
  6. isAbsoluteURL(String url)
  7. isAbsoluteURL(String url)
  8. isAbsoluteURL(String url)
  9. isAbsoluteUrl(String url)