org.apache.tools.ant.types.resources

Class BZip2Resource

Implemented Interfaces:
Cloneable, 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

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

BZip2Resource()
A no-arg constructor
BZip2Resource(ResourceCollection other)
Constructor with another resource to wrap.

Method Summary

protected String
getCompressionName()
Get the name of the compression method.
protected InputStream
wrapStream(InputStream in)
Decompress on the fly using CBZip2InputStream.
protected OutputStream
wrapStream(OutputStream out)
Compress on the fly using CBZip2OutputStream.

Methods inherited from class org.apache.tools.ant.types.resources.CompressedResource

addConfigured, compareTo, getCompressionName, getInputStream, getLastModified, getName, getOutputStream, getSize, hashCode, isDirectory, isExists, isFilesystemOnly, setDirectory, setExists, setLastModified, setName, setRefid, setSize, toString, wrapStream, wrapStream

Methods inherited from class org.apache.tools.ant.types.Resource

clone, compareTo, equals, getInputStream, getLastModified, getMagicNumber, getName, getOutputStream, getSize, hashCode, isDirectory, isExists, isFilesystemOnly, iterator, setDirectory, setExists, setLastModified, setName, setRefid, setSize, size, toLongString, toString

Methods inherited from class org.apache.tools.ant.types.DataType

checkAttributesAllowed, checkChildrenAllowed, circularReference, clone, dieOnCircularReference, dieOnCircularReference, dieOnCircularReference, getCheckedRef, getCheckedRef, getCheckedRef, getCheckedRef, getDataTypeName, getRefid, invokeCircularReferenceCheck, isChecked, isReference, noChildrenAllowed, setChecked, setRefid, toString, tooManyAttributes

Methods inherited from class org.apache.tools.ant.ProjectComponent

clone, getDescription, getLocation, getProject, log, log, setDescription, setLocation, setProject

Constructor Details

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 Details

getCompressionName

protected String getCompressionName()
Get the name of the compression method.
Overrides:
getCompressionName in interface CompressedResource
Returns:
the string "Bzip2".

wrapStream

protected InputStream wrapStream(InputStream in)
            throws IOException
Overrides:
wrapStream in interface CompressedResource
Parameters:
in - the stream to wrap.
Returns:
the wrapped stream.

wrapStream

protected OutputStream wrapStream(OutputStream out)
            throws IOException
Overrides:
wrapStream in interface CompressedResource
Parameters:
out - the stream to wrap.
Returns:
the wrapped stream.