org.opengis.cite.owc.util
Class URIUtils

java.lang.Object
  extended by org.opengis.cite.owc.util.URIUtils

public class URIUtils
extends Object

Provides a collection of utility methods for manipulating or resolving URI references.


Constructor Summary
URIUtils()
           
 
Method Summary
static String resolveRelativeURI(String baseURI, String path)
          Constructs an absolute URI value from a relative reference and a base URI.
static Document resolveURIAsDocument(URI uriRef)
          Parses the content of the given URI as an XML document and returns a new DOM Document object.
static File resolveURIAsFile(URI uriRef)
          Resolves the given URI and stores the resulting resource representation in a local file.
 
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

resolveURIAsDocument

public static Document resolveURIAsDocument(URI uriRef)
                                     throws SAXException,
                                            IOException
Parses the content of the given URI as an XML document and returns a new DOM Document object. Entity reference nodes will not be expanded. XML inclusions (xi:include elements) will be processed if present.

Parameters:
uriRef - An absolute URI specifying the location of an XML resource.
Returns:
A DOM Document node representing an XML resource.
Throws:
SAXException - If the resource cannot be parsed.
IOException - If the resource is not accessible.

resolveURIAsFile

public static File resolveURIAsFile(URI uriRef)
                             throws IOException
Resolves the given URI and stores the resulting resource representation in a local file. The file will be located in the default temporary file directory.

Parameters:
uriRef - An absolute URI specifying the location of some resource.
Returns:
A File containing the content of the resource; it may be empty if resolution failed for any reason.
Throws:
IOException - If an IO error occurs.

resolveRelativeURI

public static String resolveRelativeURI(String baseURI,
                                        String path)
Constructs an absolute URI value from a relative reference and a base URI.

Parameters:
baseURI - The base URI; it must contain at least the scheme component.
path - A URI reference (path) that is relative to the given base URI.
Returns:
A String representing the resulting URI value.
See Also:
RFC 3986, 5.2


Copyright © 2014. All Rights Reserved.