Package org.apache.tools.ant.types.resources

# Class GZipResource

java.lang.Object
org.apache.tools.ant.ProjectComponent
org.apache.tools.ant.types.DataType
org.apache.tools.ant.types.Resource
org.apache.tools.ant.types.resources.ResourceDecorator
org.apache.tools.ant.types.resources.ContentTransformingResource
org.apache.tools.ant.types.resources.CompressedResource
org.apache.tools.ant.types.resources.GZipResource

All Implemented Interfaces:
  `Cloneable`, `Comparable<Resource>`, `Iterable<Resource>`, `ResourceCollection`

public class GZipResource extends CompressedResource
A GZip compressed resource.

Wraps around another resource, delegates all queries 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

  Constructors
  Constructor
  Description
  `GZipResource()`
  A no-arg constructor
  `GZipResource(ResourceCollection other)`
  Constructor with another resource to wrap.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `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

  `toString`

  ### 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

  `asOptional, clone, equals, getMagicNumber, getRef, iterator, size, toLongString`

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

  `checkAttributesAllowed, checkChildrenAllowed, circularReference, dieOnCircularReference, dieOnCircularReference, getCheckedRef, 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`

  ### Methods inherited from interface java.lang.Iterable

  `forEach, spliterator`

  ### Methods inherited from interface org.apache.tools.ant.types.ResourceCollection

  `isEmpty, stream`

- ## 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

  - ### wrapStream

    protected InputStream wrapStream(InputStream in) throws IOException
    Decompress on the fly using java.util.zip.GZIPInputStream.
    Specified by:
      `wrapStream` in class `ContentTransformingResource`
    Parameters:
      `in` - the stream to wrap.
    Returns:
      the wrapped stream.
    Throws:
      `IOException` - if there is a problem.

  - ### wrapStream

    protected OutputStream wrapStream(OutputStream out) throws IOException
    Compress on the fly using java.util.zip.GZIPOutStream.
    Specified by:
      `wrapStream` in class `ContentTransformingResource`
    Parameters:
      `out` - the stream to wrap.
    Returns:
      the wrapped stream.
    Throws:
      `IOException` - if there is a problem.

  - ### getCompressionName

    protected String getCompressionName()
    Get the name of the compression method.
    Specified by:
      `getCompressionName` in class `CompressedResource`
    Returns:
      the string "GZip".