org.aitools.programd.util
Class URITools

java.lang.Object
  extended by org.aitools.programd.util.URITools

public class URITools
extends java.lang.Object

URITools contains helper methods for dealing with URIs.

Since:
4.2
Author:
Noel Bush

Constructor Summary
URITools()
           
 
Method Summary
static java.net.URI createValidURI(java.lang.String path)
          Attempts to create the given path into a valid URI, using a few heuristics.
static java.net.URI createValidURI(java.lang.String path, boolean tryToValidate)
          Attempts to create the given path into a valid URI, using a few heuristics.
static java.net.URI relativize(java.net.URI relativizeTo, java.lang.String subject)
          A wrapper for URI.relativize(URI), allowing the second argument to specified as a String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

URITools

public URITools()
Method Detail

createValidURI

public static java.net.URI createValidURI(java.lang.String path)
                                   throws java.io.FileNotFoundException
Attempts to create the given path into a valid URI, using a few heuristics. Tries to validate the given path, if it is a file.

Parameters:
path -
Returns:
a valid URI, if possible
Throws:
java.io.FileNotFoundException

createValidURI

public static java.net.URI createValidURI(java.lang.String path,
                                          boolean tryToValidate)
                                   throws java.io.FileNotFoundException
Attempts to create the given path into a valid URI, using a few heuristics.

Parameters:
path -
tryToValidate - whether to try to validate the given path (if it is a file)
Returns:
a valid URI, if possible
Throws:
java.io.FileNotFoundException

relativize

public static java.net.URI relativize(java.net.URI relativizeTo,
                                      java.lang.String subject)
                               throws java.io.FileNotFoundException
A wrapper for URI.relativize(URI), allowing the second argument to specified as a String. Does not attempt to validate the subject.

Parameters:
relativizeTo - the URI against which to relativize
subject - the URI to relativize
Returns:
the subject relativized to the first argument
Throws:
java.io.FileNotFoundException