Class ContentTransformingResource
java.lang.Object
org.apache.tools.ant.ProjectComponent
org.apache.tools.ant.types.DataType
org.apache.tools.ant.types.Resource
org.apache.tools.ant.types.resources.ResourceDecorator
org.apache.tools.ant.types.resources.ContentTransformingResource
- All Implemented Interfaces:
- Cloneable,- Comparable<Resource>,- Iterable<Resource>,- ResourceCollection
- Direct Known Subclasses:
- CompressedResource
A resource that transforms the content of another resource.
 
Wraps around another resource, delegates all queries (except getSize) to that other resource but transforms stream content on the fly.
- Since:
- Ant 1.8
- 
Field SummaryFields inherited from class org.apache.tools.ant.types.ResourceMAGIC, UNKNOWN_DATETIME, UNKNOWN_SIZEFields inherited from class org.apache.tools.ant.ProjectComponentdescription, location, project
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedno arg constructorprotectedConstructor with another resource to wrap.
- 
Method SummaryModifier and TypeMethodDescription<T> TSuppress FileProvider, re-implement AppendableGet an InputStream for the Resource.Get an OutputStream for the Resource.longgetSize()Get the size of this Resource.protected booleanLearn whether the transformation performed allows appends.protected abstract InputStreamGet a content-filtering/transforming InputStream.protected abstract OutputStreamwrapStream(OutputStream out) Get a content-filtering/transforming OutputStream.Methods inherited from class org.apache.tools.ant.types.resources.ResourceDecoratoraddConfigured, compareTo, dieOnCircularReference, getLastModified, getName, getResource, hashCode, isDirectory, isExists, isFilesystemOnly, setDirectory, setExists, setLastModified, setName, setRefid, setSizeMethods inherited from class org.apache.tools.ant.types.ResourceasOptional, clone, equals, getMagicNumber, getRef, iterator, size, toLongString, toStringMethods inherited from class org.apache.tools.ant.types.DataTypecheckAttributesAllowed, checkChildrenAllowed, circularReference, dieOnCircularReference, dieOnCircularReference, getCheckedRef, getCheckedRef, getCheckedRef, getCheckedRef, getCheckedRef, getDataTypeName, getRefid, invokeCircularReferenceCheck, isChecked, isReference, noChildrenAllowed, pushAndInvokeCircularReferenceCheck, setChecked, tooManyAttributesMethods inherited from class org.apache.tools.ant.ProjectComponentgetDescription, getLocation, getProject, log, log, setDescription, setLocation, setProjectMethods inherited from class java.lang.Objectfinalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.IterableforEach, spliteratorMethods inherited from interface org.apache.tools.ant.types.ResourceCollectionisEmpty, stream
- 
Constructor Details- 
ContentTransformingResourceprotected ContentTransformingResource()no arg constructor
- 
ContentTransformingResourceConstructor with another resource to wrap.- Parameters:
- other- the resource to wrap.
 
 
- 
- 
Method Details- 
getSizepublic long getSize()Get the size of this Resource.- Overrides:
- getSizein class- ResourceDecorator
- Returns:
- the size, as a long, 0 if the Resource does not exist (for compatibility with java.io.File), or UNKNOWN_SIZE if not known.
 
- 
getInputStreamGet an InputStream for the Resource.- Overrides:
- getInputStreamin class- ResourceDecorator
- Returns:
- an InputStream containing this Resource's content.
- Throws:
- IOException- if unable to provide the content of this Resource as a stream.
- UnsupportedOperationException- if InputStreams are not supported for this Resource type.
 
- 
getOutputStreamGet an OutputStream for the Resource.- Overrides:
- getOutputStreamin class- ResourceDecorator
- Returns:
- an OutputStream to which content can be written.
- Throws:
- IOException- if unable to provide the content of this Resource as a stream.
- UnsupportedOperationException- if OutputStreams are not supported for this Resource type.
 
- 
asSuppress FileProvider, re-implement Appendable- Overrides:
- asin class- ResourceDecorator
- Type Parameters:
- T- desired type
- Parameters:
- clazz- a class
- Returns:
- resource of a desired type
 
- 
isAppendSupportedprotected boolean isAppendSupported()Learn whether the transformation performed allows appends.In general compressed outputs will become invalid if they are appended to, for example. This implementations returns false. - Returns:
- boolean false
 
- 
wrapStreamGet a content-filtering/transforming InputStream.- Parameters:
- in- InputStream to wrap, will never be null.
- Returns:
- a compressed InputStream.
- Throws:
- IOException- if there is a problem.
 
- 
wrapStreamGet a content-filtering/transforming OutputStream.- Parameters:
- out- OutputStream to wrap, will never be null.
- Returns:
- a compressed OutputStream.
- Throws:
- IOException- if there is a problem.
 
 
-