org.apache.tools.ant.types.resources
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.
Since: Ant 1.8
Constructor Summary | |
---|---|
protected | ContentTransformingResource() no arg constructor |
protected | ContentTransformingResource(ResourceCollection other)
Constructor with another resource to wrap. |
Method Summary | |
---|---|
Object | as(Class clazz)
Suppress FileProvider, re-implement Appendable |
InputStream | getInputStream()
Get an InputStream for the Resource. |
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 InputStream | wrapStream(InputStream in)
Get a content-filtering/transforming InputStream.
|
protected abstract OutputStream | wrapStream(OutputStream out)
Get a content-filtering/transforming OutputStream.
|
Parameters: other the resource to wrap.
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.
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.
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.
In general compressed outputs will become invalid if they are appended to, for example.
This implementations returns false.
Parameters: in InputStream to wrap, will never be null.
Returns: a compressed inputstream.
Throws: IOException if there is a problem.
Parameters: out OutputStream to wrap, will never be null.
Returns: a compressed outputstream.
Throws: IOException if there is a problem.