Package org.exolab.castor.net.util
Class URIUtils
java.lang.Object
org.exolab.castor.net.util.URIUtils
-
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 Reader
Returns a Reader for the file represented by the href argumentstatic String
getRelativeURI
(String href) Returns the relative URI of the href argumentstatic String
This method removes "." or ".." from absolute URL.static String
resolveAsString
(String href, String 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
-
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
-
getDocumentBase
-
getRelativeURI
-
normalize
This method removes "." or ".." from absolute URL. I needed this method because the JDK doesn't do this automatically when creating URLs.- Parameters:
absoluteURL
- the absolute URI to normalize- Throws:
MalformedURLException
-
resolveAsString
-