Package org.exolab.adaptx.net.impl
Class URIUtils
- java.lang.Object
-
- org.exolab.adaptx.net.impl.URIUtils
-
public class URIUtils extends java.lang.Object
A utility class for URI handling- Author:
- Keith Visco
-
-
Constructor Summary
Constructors Constructor Description URIUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
getDocumentBase(java.lang.String href)
Returns the document base of the href argumentstatic java.io.InputStream
getInputStream(java.lang.String href, java.lang.String documentBase)
Returns an InputStream for the file represented by the href argumentstatic java.io.OutputStream
getOutputStream(java.lang.String href, java.lang.String documentBase)
Returns an OutputStream for the file represented by the href argumentstatic java.io.Reader
getReader(java.lang.String href, java.lang.String documentBase)
Returns a Reader for the file represented by the href argumentstatic java.lang.String
getRelativeURI(java.lang.String href)
Returns the relative URI of the href argumentstatic java.io.Writer
getWriter(java.lang.String href, java.lang.String documentBase)
Returns a Writer for the file represented by the href argumentstatic java.lang.String
resolveAsString(java.lang.String href, java.lang.String documentBase)
Returns the given href + documentBase
-
-
-
Method Detail
-
getInputStream
public static java.io.InputStream getInputStream(java.lang.String href, java.lang.String documentBase) throws java.io.FileNotFoundException, java.io.IOException
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 foundjava.io.IOException
-
getOutputStream
public static java.io.OutputStream getOutputStream(java.lang.String href, java.lang.String documentBase) throws java.io.FileNotFoundException, java.io.IOException
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 foundjava.io.IOException
-
getReader
public static java.io.Reader getReader(java.lang.String href, java.lang.String documentBase) throws java.io.FileNotFoundException, java.io.IOException
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 foundjava.io.IOException
-
getWriter
public static java.io.Writer getWriter(java.lang.String href, java.lang.String documentBase) throws java.io.FileNotFoundException, java.io.IOException
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 foundjava.io.IOException
-
getDocumentBase
public static java.lang.String getDocumentBase(java.lang.String href)
Returns the document base of the href argument- Returns:
- the document base of the given href
-
getRelativeURI
public static java.lang.String getRelativeURI(java.lang.String href)
Returns the relative URI of the href argument- Returns:
- the relative URI the given href
-
resolveAsString
public static java.lang.String resolveAsString(java.lang.String href, java.lang.String documentBase)
Returns the given href + documentBase- Returns:
- the absolute URL as a string
-
-