public abstract class ContentTransformingResource extends ResourceDecorator
Wraps around another resource, delegates all queries (except getSize) to that other resource but transforms stream content on the fly.
MAGIC, UNKNOWN_DATETIME, UNKNOWN_SIZEdescription, location, project| Modifier | Constructor and Description |
|---|---|
protected |
ContentTransformingResource()
no arg constructor
|
protected |
ContentTransformingResource(ResourceCollection other)
Constructor with another resource to wrap.
|
| Modifier and Type | Method and Description |
|---|---|
<T> T |
as(java.lang.Class<T> clazz)
Suppress FileProvider, re-implement Appendable
|
java.io.InputStream |
getInputStream()
Get an InputStream for the Resource.
|
java.io.OutputStream |
getOutputStream()
Get an OutputStream for the Resource.
|
long |
getSize()
Get the size of this Resource.
|
protected boolean |
isAppendSupported()
Learn whether the transformation performed allows appends.
|
protected abstract java.io.InputStream |
wrapStream(java.io.InputStream in)
Get a content-filtering/transforming InputStream.
|
protected abstract java.io.OutputStream |
wrapStream(java.io.OutputStream out)
Get a content-filtering/transforming OutputStream.
|
addConfigured, compareTo, dieOnCircularReference, getLastModified, getName, getResource, hashCode, isDirectory, isExists, isFilesystemOnly, setDirectory, setExists, setLastModified, setName, setRefid, setSizeclone, equals, getMagicNumber, iterator, size, toLongString, toStringcheckAttributesAllowed, checkChildrenAllowed, circularReference, dieOnCircularReference, dieOnCircularReference, getCheckedRef, getCheckedRef, getCheckedRef, getCheckedRef, getDataTypeName, getRefid, invokeCircularReferenceCheck, isChecked, isReference, noChildrenAllowed, pushAndInvokeCircularReferenceCheck, setChecked, tooManyAttributesgetDescription, getLocation, getProject, log, log, setDescription, setLocation, setProjectprotected ContentTransformingResource()
protected ContentTransformingResource(ResourceCollection other)
other - the resource to wrap.public long getSize()
getSize in class ResourceDecoratorpublic java.io.InputStream getInputStream()
throws java.io.IOException
getInputStream in class ResourceDecoratorjava.io.IOException - if unable to provide the content of this
Resource as a stream.java.lang.UnsupportedOperationException - if InputStreams are not
supported for this Resource type.public java.io.OutputStream getOutputStream()
throws java.io.IOException
getOutputStream in class ResourceDecoratorjava.io.IOException - if unable to provide the content of this
Resource as a stream.java.lang.UnsupportedOperationException - if OutputStreams are not
supported for this Resource type.public <T> T as(java.lang.Class<T> clazz)
as in class ResourceDecoratorprotected boolean isAppendSupported()
In general compressed outputs will become invalid if they are appended to, for example.
This implementations returns false.
protected abstract java.io.InputStream wrapStream(java.io.InputStream in)
throws java.io.IOException
in - InputStream to wrap, will never be null.java.io.IOException - if there is a problem.protected abstract java.io.OutputStream wrapStream(java.io.OutputStream out)
throws java.io.IOException
out - OutputStream to wrap, will never be null.java.io.IOException - if there is a problem.