org.abstracthorizon.extend.server.support
Class URLUtils

java.lang.Object
  extended by org.abstracthorizon.extend.server.support.URLUtils

public class URLUtils
extends Object

Class with utility methods for URLs.

Author:
Daniel Sendula

Constructor Summary
URLUtils()
           
 
Method Summary
static URI add(URI uri, String file)
          Adds given file to the file portion of supplied url
static URL add(URL url, String file)
          Adds given file to the file portion of supplied url
static String addPaths(String p1, String p2)
           
static boolean exists(URI uri)
          Retruns true if a file or directory (or any content) exists at given URL.
static boolean exists(URL url)
          Retruns true if a file or directory (or any content) exists at given URL.
static boolean isFolder(URI url)
          Checks if given URI represents folder or file.
static boolean isFolder(URL url)
          Checks if given url represents folder or file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

URLUtils

public URLUtils()
Method Detail

add

public static URL add(URL url,
                      String file)
               throws MalformedURLException
Adds given file to the file portion of supplied url

Parameters:
url - url
file - string to be added to the end of file part of given url
Returns:
new url
Throws:
MalformedURLException

add

public static URI add(URI uri,
                      String file)
               throws URISyntaxException
Adds given file to the file portion of supplied url

Parameters:
uri - URI
file - string to be added to the end of file part of given url
Returns:
new URI
Throws:
MalformedURLException
URISyntaxException

exists

public static boolean exists(URL url)
Retruns true if a file or directory (or any content) exists at given URL. If URL's protocol is not file then URL.openStream() method is used.

Parameters:
url -
Returns:
true if content exists

exists

public static boolean exists(URI uri)
Retruns true if a file or directory (or any content) exists at given URL. If URL's protocol is not file then URL.openStream() method is used.

Parameters:
uri -
Returns:
true if content exists

isFolder

public static boolean isFolder(URL url)
Checks if given url represents folder or file. Folder is if it ends with "/"

Parameters:
url - url
Returns:
true if it is a folder

isFolder

public static boolean isFolder(URI url)
Checks if given URI represents folder or file. Folder is if it ends with "/"

Parameters:
url - URI
Returns:
true if it is a folder

addPaths

public static String addPaths(String p1,
                              String p2)


Copyright © 2005-2009 Abstract Horizon. All Rights Reserved.