org.apache.tools.ant.types.resources

Class GZipResource

Implemented Interfaces:
Cloneable, Comparable, ResourceCollection

public class GZipResource
extends CompressedResource

A GZip 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

GZipResource()
A no-arg constructor
GZipResource(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 java.util.zip.GZIPInputStream.
protected OutputStream
wrapStream(OutputStream out)
Compress on the fly using java.util.zip.GZIPOutStream.

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

GZipResource

public GZipResource()
A no-arg constructor

GZipResource

public GZipResource(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 "GZip".

wrapStream

protected InputStream wrapStream(InputStream in)
            throws IOException
Decompress on the fly using java.util.zip.GZIPInputStream.
Overrides:
wrapStream in interface CompressedResource
Parameters:
in - the stream to wrap.
Returns:
the wrapped stream.

wrapStream

protected OutputStream wrapStream(OutputStream out)
            throws IOException
Compress on the fly using java.util.zip.GZIPOutStream.
Overrides:
wrapStream in interface CompressedResource
Parameters:
out - the stream to wrap.
Returns:
the wrapped stream.