org.bounce.util
Class URIUtils

java.lang.Object
  extended by org.bounce.util.URIUtils

public class URIUtils
extends Object

Put comment...

Version:
$Revision$, $Date$
Author:
Edwin Dankert

Constructor Summary
URIUtils()
           
 
Method Summary
static File composeFile(URI base, String relativePath)
          Return the absolute path, composed from a base URI and a relative path.
static String composePath(URI base, String relativePath)
          Return the absolute path, composed from a base URI and a relative path.
static URI composeURI(URI base, String relativePath)
          Return the absolute URI, composed from a base URI and a relative path.
static URI createURI(String path)
          Creates a URI from a path, the path can be relative or absolute, '\' and '/' are normalised.
static String getDirectoryName(URI uri)
          Returns the name of the directory that is pointed to by this URI.
static String getExtension(URI uri)
          Returns the extension of the file that is pointed to by this URI.
static String getName(URI uri)
          Returns the name of the file that is pointed to by this URI.
static String getRelativePath(URI base, File file)
          Return the path for the file relative to the base uri.
static URI getRelativeURI(URI base, URI uri)
          Return the uri for the uri relative to the base uri.
static File toFile(URI uri)
          Creates a File from a URI, the URI can be relative or absolute, this method returns only a file for the Scheme Specific Part.
static String toString(URI uri)
          Creates a String from a URI, the URI can be relative or absolute, the URI is decoded.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

URIUtils

public URIUtils()
Method Detail

getName

public static String getName(URI uri)
Returns the name of the file that is pointed to by this URI.

Parameters:
uri - the uri to get the name for.
Returns:
the name of the file.

getExtension

public static String getExtension(URI uri)
Returns the extension of the file that is pointed to by this URI.

Parameters:
uri - the uri to get the extension for.
Returns:
the extension of the file.

getDirectoryName

public static String getDirectoryName(URI uri)
Returns the name of the directory that is pointed to by this URI.

Parameters:
uri - the uri to get the directory name for.
Returns:
the name of the directory.

createURI

public static URI createURI(String path)
Creates a URI from a path, the path can be relative or absolute, '\' and '/' are normalised.

Parameters:
path - the path to create the URI for.
Returns:
a new URI.

toString

public static String toString(URI uri)
Creates a String from a URI, the URI can be relative or absolute, the URI is decoded. TODO Why can't I just return uri.toString()???

Parameters:
uri - the URI to return the string representation for.
Returns:
a string representation of the URI.

toFile

public static File toFile(URI uri)
Creates a File from a URI, the URI can be relative or absolute, this method returns only a file for the Scheme Specific Part.

Parameters:
uri - the URI to create the file for.
Returns:
a new file.

getRelativeURI

public static URI getRelativeURI(URI base,
                                 URI uri)
Return the uri for the uri relative to the base uri.

Parameters:
base - the base uri.
uri - the file location to get the relative path for.
Returns:
the relative uri.

getRelativePath

public static String getRelativePath(URI base,
                                     File file)
Return the path for the file relative to the base uri.

Parameters:
base - the base url.
file - the file location to get the relative path for.
Returns:
the relative path.

composeURI

public static URI composeURI(URI base,
                             String relativePath)
Return the absolute URI, composed from a base URI and a relative path.

Parameters:
base - the base uri.
relativePath - the relative path.
Returns:
the absolute URI.

composeFile

public static File composeFile(URI base,
                               String relativePath)
Return the absolute path, composed from a base URI and a relative path.

Parameters:
base - the base uri.
relativePath - the relative path.
Returns:
the absolute path.

composePath

public static String composePath(URI base,
                                 String relativePath)
Return the absolute path, composed from a base URI and a relative path.

Parameters:
base - the base uri.
relativePath - the relative path.
Returns:
the absolute path.


Copyright © 2002-2011 Edwin Dankert. All Rights Reserved.