Package org.apache.fop.apps.io
Class InternalResourceResolver
- java.lang.Object
-
- org.apache.fop.apps.io.InternalResourceResolver
-
public class InternalResourceResolver extends java.lang.Object
This object holds the base URI from which to resolve URIs against as well as the resolver for resource acquisition. It also does some URI sanitization of common URI syntactical errors. This class takes in aResourceResolver
and delegates all relevant URIs to it.
-
-
Field Summary
Fields Modifier and Type Field Description private java.net.URI
baseUri
private org.apache.xmlgraphics.util.uri.DataURIResolver
dataSchemeResolver
private org.apache.xmlgraphics.io.ResourceResolver
resourceResolver
-
Constructor Summary
Constructors Constructor Description InternalResourceResolver(java.net.URI baseUri, org.apache.xmlgraphics.io.ResourceResolver resourceResolver)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.net.URI
cleanURI(java.lang.String uriStr)
Performs some sanitation for some of the most common URI syntax mistakes.java.net.URI
getBaseURI()
Returns the base URI from which to resolve all URIs against.static java.net.URI
getBaseURI(java.lang.String base)
Performs some sanitation for some of the most common URI syntax mistakes but returns a directory URI rather than a file URI.java.io.OutputStream
getOutputStream(java.net.URI uri)
Returns the OutputStream for a given URI.org.apache.xmlgraphics.io.Resource
getResource(java.lang.String stringUri)
Retrieve a resource given a URI in String form.org.apache.xmlgraphics.io.Resource
getResource(java.net.URI uri)
Retrieve a resource given a URI in String form.private java.io.InputStream
resolveDataURI(java.lang.String dataURI)
java.net.URI
resolveFromBase(java.net.URI uri)
Resolves a URI against the base URI.
-
-
-
Method Detail
-
getBaseURI
public java.net.URI getBaseURI()
Returns the base URI from which to resolve all URIs against.- Returns:
- the base URI
-
getResource
public org.apache.xmlgraphics.io.Resource getResource(java.lang.String stringUri) throws java.io.IOException, java.net.URISyntaxException
Retrieve a resource given a URI in String form. This also does some syntactical sanitaion on the URI.- Parameters:
stringUri
- the URI in String form- Returns:
- the resource
- Throws:
java.io.IOException
- if an I/O error occurredjava.net.URISyntaxException
- if the URI syntax was invalid
-
getResource
public org.apache.xmlgraphics.io.Resource getResource(java.net.URI uri) throws java.io.IOException
Retrieve a resource given a URI in String form.- Parameters:
uri
- the resource URI- Returns:
- the resource
- Throws:
java.io.IOException
- if an I/O error occurred
-
getOutputStream
public java.io.OutputStream getOutputStream(java.net.URI uri) throws java.io.IOException
Returns the OutputStream for a given URI.- Parameters:
uri
- the URI for the inteded stream- Returns:
- the output stream
- Throws:
java.io.IOException
- if an I/O error occurrred
-
resolveFromBase
public java.net.URI resolveFromBase(java.net.URI uri)
Resolves a URI against the base URI.- Parameters:
uri
- the URI that requires resolution- Returns:
- the resolved URI
-
cleanURI
public static java.net.URI cleanURI(java.lang.String uriStr) throws java.net.URISyntaxException
Performs some sanitation for some of the most common URI syntax mistakes.- Parameters:
uriStr
- the URI in String form- Returns:
- a valid URI
- Throws:
java.net.URISyntaxException
- if the given String was too erroneous to validate
-
getBaseURI
public static java.net.URI getBaseURI(java.lang.String base) throws java.net.URISyntaxException
Performs some sanitation for some of the most common URI syntax mistakes but returns a directory URI rather than a file URI.- Parameters:
base
- the directory URI in String form- Returns:
- the directory URI
- Throws:
java.net.URISyntaxException
- if the given String was too erroneous to validate
-
resolveDataURI
private java.io.InputStream resolveDataURI(java.lang.String dataURI)
-
-