org.exolab.adaptx.net.impl

Class URIUtils

public class URIUtils extends Object

A utility class for URI handling

Author: Keith Visco

Method Summary
static StringgetDocumentBase(String href)
Returns the document base of the href argument
static InputStreamgetInputStream(String href, String documentBase)
Returns an InputStream for the file represented by the href argument
static OutputStreamgetOutputStream(String href, String documentBase)
Returns an OutputStream for the file represented by the href argument
static ReadergetReader(String href, String documentBase)
Returns a Reader for the file represented by the href argument
static StringgetRelativeURI(String href)
Returns the relative URI of the href argument
static WritergetWriter(String href, String documentBase)
Returns a Writer for the file represented by the href argument
static StringresolveAsString(String href, String documentBase)
Returns the given href + documentBase

Method Detail

getDocumentBase

public static String getDocumentBase(String href)
Returns the document base of the href argument

Returns: the document base of the given href

getInputStream

public static InputStream getInputStream(String href, String documentBase)
Returns an InputStream for the file represented by the href argument

Parameters: href the href of the file to get the input stream for. documentBase the document base of the href argument, if it is a relative href set documentBase to null if there is none.

Returns: an InputStream to the desired resource

Throws: java.io.FileNotFoundException when the file could not be found

getOutputStream

public static OutputStream getOutputStream(String href, String documentBase)
Returns an OutputStream for the file represented by the href argument

Parameters: href the href of the file to get the input stream for. documentBase the document base of the href argument, if it is a relative href set documentBase to null if there is none.

Returns: an OutputStream to the desired resource

Throws: java.io.FileNotFoundException when the file could not be found

getReader

public static Reader getReader(String href, String documentBase)
Returns a Reader for the file represented by the href argument

Parameters: href the href of the file to get the input stream for. documentBase the document base of the href argument, if it is a relative href set documentBase to null if there is none.

Returns: an InputStream to the desired resource

Throws: java.io.FileNotFoundException when the file could not be found

getRelativeURI

public static String getRelativeURI(String href)
Returns the relative URI of the href argument

Returns: the relative URI the given href

getWriter

public static Writer getWriter(String href, String documentBase)
Returns a Writer for the file represented by the href argument

Parameters: href the href of the file to get the input stream for. documentBase the document base of the href argument, if it is a relative href set documentBase to null if there is none.

Returns: a Writer to the desired resource

Throws: java.io.FileNotFoundException when the file could not be found

resolveAsString

public static String resolveAsString(String href, String documentBase)
Returns the given href + documentBase

Returns: the absolute URL as a string