|
xmlgraphics-commons 2.0 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.xmlgraphics.image.loader.impl.AbstractImageSessionContext
public abstract class AbstractImageSessionContext
Abstract base class for classes implementing ImageSessionContext. This class provides all the special treatment for Source creation, i.e. it provides optimized Source objects where possible.
| Nested Class Summary | |
|---|---|
static interface |
AbstractImageSessionContext.FallbackResolver
Implementations of this interface will be used as the mechanism for creating the Source that wraps resources. |
static class |
AbstractImageSessionContext.RestrictedFallbackResolver
This fallback resolver is to be used in environments where controlling file access is of critical importance. |
static class |
AbstractImageSessionContext.UnrestrictedFallbackResolver
An unrestricted resolver that has various contingency mechanisms that access the file-system. |
| Constructor Summary | |
|---|---|
AbstractImageSessionContext()
|
|
AbstractImageSessionContext(AbstractImageSessionContext.FallbackResolver fallbackResolver)
|
|
| Method Summary | |
|---|---|
protected static ImageInputStream |
createImageInputStream(InputStream in)
|
Source |
getSource(String uri)
Returns a Source object for a URI. |
protected boolean |
isReusable(Source src)
Indicates whether a Source is reusable. |
Source |
needSource(String uri)
Returns a Source object for a URI. |
Source |
newSource(String uri)
Attempts to create a Source object from the given URI. |
protected abstract Source |
resolveURI(String uri)
Attempts to resolve the given URI. |
void |
returnSource(String uri,
Source src)
Returns a Source object to a pool. |
static File |
toFile(URL url)
Convert from a URL to a File. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.apache.xmlgraphics.image.loader.ImageSessionContext |
|---|
getParentContext, getTargetResolution |
| Constructor Detail |
|---|
public AbstractImageSessionContext()
public AbstractImageSessionContext(AbstractImageSessionContext.FallbackResolver fallbackResolver)
fallbackResolver - the fallback resolution mechanism to be used when simply getting an
InputStream that backs a Source isn't possible.| Method Detail |
|---|
protected abstract Source resolveURI(String uri)
uri - URI to access
Source object, or null if the URI
cannot be resolved.public Source newSource(String uri)
newSource in interface ImageSessionContexturi - URI to access
Source object, or null if the URI
cannot be resolved.
protected static ImageInputStream createImageInputStream(InputStream in)
throws IOException
IOExceptionpublic static File toFile(URL url)
URL to a File.
This method will decode the URL.
Syntax such as file:///my%20docs/file.txt will be
correctly decoded to /my docs/file.txt.
Note: this method has been copied over from Apache Commons IO and enhanced to support UNC paths.
url - the file URL to convert, null returns null
File object, or null
if the URL's protocol is not file
IllegalArgumentException - if the file is incorrectly encodedpublic Source getSource(String uri)
ImageSessionContext.returnSource(String, Source) method).
getSource in interface ImageSessionContexturi - the URI of the image
public Source needSource(String uri)
throws FileNotFoundException
FileNotFoundException is thrown.
needSource in interface ImageSessionContexturi - the URI of the image
FileNotFoundException - if the image cannot be found
public void returnSource(String uri,
Source src)
returnSource in interface ImageSessionContexturi - the URI of the imagesrc - the Source object belonging to the URIprotected boolean isReusable(Source src)
ImageSource (containing an ImageInputStream) or a DOMSource.
src - the Source object
|
xmlgraphics-commons 2.0 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||