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