org.apache.ant.compress.resources
Class CommonsCompressCompressorResource

java.lang.Object
  extended by org.apache.tools.ant.ProjectComponent
      extended by org.apache.tools.ant.types.DataType
          extended by org.apache.tools.ant.types.Resource
              extended by org.apache.tools.ant.types.resources.ResourceDecorator
                  extended by org.apache.tools.ant.types.resources.ContentTransformingResource
                      extended by org.apache.ant.compress.resources.CommonsCompressCompressorResource
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Comparable, org.apache.tools.ant.types.ResourceCollection
Direct Known Subclasses:
BZip2Resource, GZipResource, Pack200Resource, XZResource

public abstract class CommonsCompressCompressorResource
extends org.apache.tools.ant.types.resources.ContentTransformingResource

A compressed resource.

Wraps around another resource, delegates all queries to that other resource but uncompresses/compresses streams on the fly.


Field Summary
 
Fields inherited from class org.apache.tools.ant.types.Resource
MAGIC, UNKNOWN_DATETIME, UNKNOWN_SIZE
 
Fields inherited from class org.apache.tools.ant.types.DataType
checked, ref
 
Fields inherited from class org.apache.tools.ant.ProjectComponent
description, location, project
 
Constructor Summary
protected CommonsCompressCompressorResource(java.lang.String name, CompressorStreamFactory factory)
          A no-arg constructor
protected CommonsCompressCompressorResource(java.lang.String name, CompressorStreamFactory factory, org.apache.tools.ant.types.ResourceCollection other)
          Constructor with another resource to wrap.
 
Method Summary
 void setDecompressConcatenated(boolean b)
          Whether to extract the whole resource if it contains multiple concatenated streams.
 java.lang.String toString()
          Get the string representation of this Resource.
protected  java.io.InputStream wrapStream(java.io.InputStream in)
          Decompress on the fly.
protected  java.io.OutputStream wrapStream(java.io.OutputStream out)
          Compress on the fly.
 
Methods inherited from class org.apache.tools.ant.types.resources.ContentTransformingResource
as, getInputStream, getOutputStream, getSize, isAppendSupported
 
Methods inherited from class org.apache.tools.ant.types.resources.ResourceDecorator
addConfigured, compareTo, dieOnCircularReference, getLastModified, getName, getResource, hashCode, isDirectory, isExists, isFilesystemOnly, setDirectory, setExists, setLastModified, setName, setRefid, setSize
 
Methods inherited from class org.apache.tools.ant.types.Resource
clone, equals, getMagicNumber, iterator, size, toLongString
 
Methods inherited from class org.apache.tools.ant.types.DataType
checkAttributesAllowed, checkChildrenAllowed, circularReference, dieOnCircularReference, dieOnCircularReference, getCheckedRef, getCheckedRef, getCheckedRef, getCheckedRef, getDataTypeName, getRefid, invokeCircularReferenceCheck, isChecked, isReference, noChildrenAllowed, pushAndInvokeCircularReferenceCheck, setChecked, tooManyAttributes
 
Methods inherited from class org.apache.tools.ant.ProjectComponent
getDescription, getLocation, getProject, log, log, setDescription, setLocation, setProject
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CommonsCompressCompressorResource

protected CommonsCompressCompressorResource(java.lang.String name,
                                            CompressorStreamFactory factory)
A no-arg constructor


CommonsCompressCompressorResource

protected CommonsCompressCompressorResource(java.lang.String name,
                                            CompressorStreamFactory factory,
                                            org.apache.tools.ant.types.ResourceCollection other)
Constructor with another resource to wrap.

Parameters:
other - the resource to wrap.
Method Detail

setDecompressConcatenated

public void setDecompressConcatenated(boolean b)
Whether to extract the whole resource if it contains multiple concatenated streams.

Defaults to false for backwards compatibility.

Since:
Apache Compress Antlib 1.2

wrapStream

protected final java.io.InputStream wrapStream(java.io.InputStream in)
                                        throws java.io.IOException
Decompress on the fly.

Specified by:
wrapStream in class org.apache.tools.ant.types.resources.ContentTransformingResource
Parameters:
in - the stream to wrap.
Returns:
the wrapped stream.
Throws:
java.io.IOException - if there is a problem.

wrapStream

protected final java.io.OutputStream wrapStream(java.io.OutputStream out)
                                         throws java.io.IOException
Compress on the fly.

Specified by:
wrapStream in class org.apache.tools.ant.types.resources.ContentTransformingResource
Parameters:
out - the stream to wrap.
Returns:
the wrapped stream.
Throws:
java.io.IOException - if there is a problem.

toString

public java.lang.String toString()
Get the string representation of this Resource.

Overrides:
toString in class org.apache.tools.ant.types.Resource
Returns:
this Resource formatted as a String.