org.apache.tools.ant.types.resources
Class BZip2Resource

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.CompressedResource
                  extended by org.apache.tools.ant.types.resources.BZip2Resource
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Comparable, ResourceCollection

public class BZip2Resource
extends CompressedResource

A Bzip2 compressed resource.

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

Since:
Ant 1.7

Field Summary
 
Fields inherited from class org.apache.tools.ant.types.Resource
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
BZip2Resource()
          A no-arg constructor
BZip2Resource(ResourceCollection other)
          Constructor with another resource to wrap.
 
Method Summary
protected  java.lang.String getCompressionName()
          Get the name of the compression method.
protected  java.io.InputStream wrapStream(java.io.InputStream in)
          Decompress on the fly using CBZip2InputStream.
protected  java.io.OutputStream wrapStream(java.io.OutputStream out)
          Compress on the fly using CBZip2OutputStream.
 
Methods inherited from class org.apache.tools.ant.types.resources.CompressedResource
addConfigured, compareTo, getInputStream, getLastModified, getName, getOutputStream, getSize, hashCode, isDirectory, isExists, isFilesystemOnly, setDirectory, setExists, setLastModified, setName, setRefid, setSize, toString
 
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, dieOnCircularReference, getCheckedRef, getCheckedRef, getCheckedRef, getCheckedRef, getDataTypeName, getRefid, invokeCircularReferenceCheck, isChecked, isReference, noChildrenAllowed, 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

BZip2Resource

public BZip2Resource()
A no-arg constructor


BZip2Resource

public BZip2Resource(ResourceCollection other)
Constructor with another resource to wrap.

Parameters:
other - the resource to wrap.
Method Detail

wrapStream

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

Specified by:
wrapStream in class CompressedResource
Parameters:
in - the stream to wrap.
Returns:
the wrapped stream.
Throws:
java.io.IOException - if there is a problem.

wrapStream

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

Specified by:
wrapStream in class CompressedResource
Parameters:
out - the stream to wrap.
Returns:
the wrapped stream.
Throws:
java.io.IOException - if there is a problem.

getCompressionName

protected java.lang.String getCompressionName()
Get the name of the compression method.

Specified by:
getCompressionName in class CompressedResource
Returns:
the string "Bzip2".