jd.xml.util
Class UriUtil

java.lang.Object
  extended byjd.xml.util.UriUtil

public abstract class UriUtil
extends Object

A collection of uri related utility methods.


Constructor Summary
UriUtil()
           
 
Method Summary
static String encodeIUri(String iuri)
           
static File getFile(String uri)
          Try to retreive a file from a uri.
static String getUri(String href, String baseUri)
          Merge a uri and a baseUri to another uri.
static boolean isAbsolutePath(String uri)
          Test if the uri is an absolute path.
static boolean isAbsoluteUri(String uri)
          Test if the uri is an absolute uri.
static XmlSource resolveUri(String href, String baseUri, UriResolver resolver)
          Resolve a uri.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UriUtil

public UriUtil()
Method Detail

isAbsoluteUri

public static boolean isAbsoluteUri(String uri)
Test if the uri is an absolute uri.


isAbsolutePath

public static boolean isAbsolutePath(String uri)
Test if the uri is an absolute path.


getUri

public static String getUri(String href,
                            String baseUri)
Merge a uri and a baseUri to another uri.

Parameters:
href - an absolute or relative uri
baseUri - an uri used to turn a relative uri into an absolute. Can be null.

resolveUri

public static XmlSource resolveUri(String href,
                                   String baseUri,
                                   UriResolver resolver)
                            throws IOException
Resolve a uri. If the supplied resolver is not null, it is called first. If the resolver is null or returns a null source, the default resolve process is used.

Parameters:
href - a href attribute, which may be relative or absolute.
baseUri - the base uri in effect when the href attribute was encountered
resolver - a UriResolver, can be null
Returns:
a XmlSource object.
Throws:
IOException - if an error occurs when trying to resolve the URI.

getFile

public static File getFile(String uri)
Try to retreive a file from a uri.

Returns:
the file or null.

encodeIUri

public static String encodeIUri(String iuri)