Top Description Fields Constructors Methods
org.apache.tools.ant.types.resources

public abstract Class ContentTransformingResource

extends ResourceDecorator
Class Inheritance
Known Direct Subclasses
org.apache.tools.ant.types.resources.CompressedResource
Imports
java.io.IOException, .InputStream, .OutputStream, org.apache.tools.ant.BuildException, org.apache.tools.ant.types.ResourceCollection

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 Summary

Modifier and TypeField and Description
private static final int

Constructor Summary

AccessConstructor and Description
protected
ContentTransformingResource()

no arg constructor

protected
ContentTransformingResource(final ResourceCollection
the resource to wrap.
other
)

Constructor with another resource to wrap.

Method Summary

Modifier and TypeMethod and Description
public <T> T
as(final Class<T>
a class
clazz
)

Overrides org.apache.tools.ant.types.resources.ResourceDecorator.as.

Suppress FileProvider, re-implement Appendable
public InputStream

Returns:

an InputStream containing this Resource's content.
getInputStream
()

Overrides org.apache.tools.ant.types.resources.ResourceDecorator.getInputStream.

Get an InputStream for the Resource.
public OutputStream

Returns:

an OutputStream to which content can be written.
getOutputStream
()

Overrides org.apache.tools.ant.types.resources.ResourceDecorator.getOutputStream.

Get an OutputStream for the Resource.
public long

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.
getSize
()

Overrides org.apache.tools.ant.types.resources.ResourceDecorator.getSize.

Get the size of this Resource.
protected boolean

Returns:

boolean false
isAppendSupported
()

Learn whether the transformation performed allows appends.

protected abstract InputStream

Returns:

a compressed InputStream.
wrapStream
(InputStream
InputStream to wrap, will never be null.
in
)

Get a content-filtering/transforming InputStream.

protected abstract OutputStream

Returns:

a compressed OutputStream.
wrapStream
(OutputStream
OutputStream to wrap, will never be null.
out
)

Get a content-filtering/transforming OutputStream.

Inherited from org.apache.tools.ant.types.resources.ResourceDecorator:
addConfiguredcompareTodieOnCircularReferencegetLastModifiedgetNamegetResourcehashCodeisDirectoryisExistsisFilesystemOnlysetDirectorysetExistssetLastModifiedsetNamesetRefidsetSize

Field Detail

BUFFER_SIZEback to summary
private static final int BUFFER_SIZE

Constructor Detail

ContentTransformingResourceback to summary
protected ContentTransformingResource()

no arg constructor

ContentTransformingResourceback to summary
protected ContentTransformingResource(final ResourceCollection other)

Constructor with another resource to wrap.

Parameters
other:ResourceCollection

the resource to wrap.

Method Detail

asback to summary
public <T> T as(final Class<T> clazz)

Overrides org.apache.tools.ant.types.resources.ResourceDecorator.as.

Suppress FileProvider, re-implement Appendable

Parameters
<T>

Doc from org.apache.tools.ant.types.Resource.as. desired type

clazz:Class<T>

Doc from org.apache.tools.ant.types.Resource.as.

a class

Returns:T

Doc from org.apache.tools.ant.types.Resource.as.

resource of a desired type

Annotations
@Override
getInputStreamback to summary
public InputStream getInputStream() throws IOException

Overrides org.apache.tools.ant.types.resources.ResourceDecorator.getInputStream.

Get an InputStream for the Resource.

Returns:InputStream

an InputStream containing this Resource's content.

Annotations
@Override
Exceptions
IOException:
if unable to provide the content of this Resource as a stream.
UnsupportedOperationException:
if InputStreams are not supported for this Resource type.
getOutputStreamback to summary
public OutputStream getOutputStream() throws IOException

Overrides org.apache.tools.ant.types.resources.ResourceDecorator.getOutputStream.

Get an OutputStream for the Resource.

Returns:OutputStream

an OutputStream to which content can be written.

Annotations
@Override
Exceptions
IOException:
if unable to provide the content of this Resource as a stream.
UnsupportedOperationException:
if OutputStreams are not supported for this Resource type.
getSizeback to summary
public long getSize()

Overrides org.apache.tools.ant.types.resources.ResourceDecorator.getSize.

Get the size of this Resource.

Returns:long

the size, as a long, 0 if the Resource does not exist (for compatibility with java.io.File), or UNKNOWN_SIZE if not known.

Annotations
@Override
isAppendSupportedback to summary
protected 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

boolean false

wrapStreamback to summary
protected abstract InputStream wrapStream(InputStream in) throws IOException

Get a content-filtering/transforming InputStream.

Parameters
in:InputStream

InputStream to wrap, will never be null.

Returns:InputStream

a compressed InputStream.

Exceptions
IOException:
if there is a problem.
wrapStreamback to summary
protected abstract OutputStream wrapStream(OutputStream out) throws IOException

Get a content-filtering/transforming OutputStream.

Parameters
out:OutputStream

OutputStream to wrap, will never be null.

Returns:OutputStream

a compressed OutputStream.

Exceptions
IOException:
if there is a problem.