CompressedResource (Apache Ant API)
Date: 2018-03-24

org.apache.tools.ant.types.resources

## Class CompressedResource

- 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

- All Implemented Interfaces:
    java.lang.Cloneable, java.lang.Comparable<Resource>, java.lang.Iterable<Resource>, ResourceCollection
  Direct Known Subclasses:
    BZip2Resource, GZipResource, XzResource

      public abstract class CompressedResource
      extends ContentTransformingResource

  A compressed resource.

  Wraps around another resource, delegates all queries (except getSize) 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
    Modifier | Constructor and Description
    --- | ---
    `protected` | `CompressedResource()` no arg constructor
    `protected` | `CompressedResource(ResourceCollection other)` Constructor with another resource to wrap.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected abstract java.lang.String` | `getCompressionName()` Get the name of the compression method used.
    `java.lang.String` | `toString()` Get the string representation of this Resource.

    - ### Methods inherited from class org.apache.tools.ant.types.resources.ContentTransformingResource

      `as, getInputStream, getOutputStream, getSize, isAppendSupported, wrapStream, wrapStream`

    - ### 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, getCheckedRef, getMagicNumber, iterator, size, toLongString`

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

      `checkAttributesAllowed, checkChildrenAllowed, circularReference, dieOnCircularReference, dieOnCircularReference, 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 org.apache.tools.ant.types.ResourceCollection

      `isEmpty, stream`

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

      `forEach, spliterator`

- - ### Constructor Detail

    - #### CompressedResource

          protected CompressedResource()

      no arg constructor

    - #### CompressedResource

          protected CompressedResource(ResourceCollection other)

      Constructor with another resource to wrap.
      Parameters:
        `other` - the resource to wrap.

  - ### Method Detail

    - #### toString

          public java.lang.String toString()

      Get the string representation of this Resource.
      Overrides:
        `toString` in class `Resource`
      Returns:
        this Resource formatted as a String.
      Since:
        Ant 1.7

    - #### getCompressionName

          protected abstract java.lang.String getCompressionName()

      Get the name of the compression method used.
      Returns:
        the name of the compression method.