org.apache.ant.compress.resources

## Class CommonsCompressCompressorResource

- 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.ant.compress.resources.CommonsCompressCompressorResource

- All Implemented Interfaces:
    java.lang.Cloneable, java.lang.Comparable<org.apache.tools.ant.types.Resource>, java.lang.Iterable<org.apache.tools.ant.types.Resource>, org.apache.tools.ant.types.ResourceCollection
  Direct Known Subclasses:
    BrotliResource, BZip2Resource, DeflateResource, GZipResource, LZ4Resource, LZMAResource, Pack200Resource, SnappyResource, XZResource, ZResource

      public abstract class CommonsCompressCompressorResource
      extends org.apache.tools.ant.types.resources.ContentTransformingResource

  A compressed resource.

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

- - ### 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` | `CommonsCompressCompressorResource(java.lang.String name)`
    `protected` | `CommonsCompressCompressorResource(java.lang.String name, CompressorStreamFactory factory)`
    `protected` | `CommonsCompressCompressorResource(java.lang.String name, CompressorStreamFactory factory, org.apache.tools.ant.types.ResourceCollection other)` Constructor with another resource to wrap.
    `protected` | `CommonsCompressCompressorResource(java.lang.String name, org.apache.tools.ant.types.ResourceCollection other)` Constructor with another resource to wrap.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `setDecompressConcatenated(boolean b)` Whether to extract the whole resource if it contains multiple concatenated streams.
    `protected void` | `setFactory(CompressorStreamFactory factory)`
    `java.lang.String` | `toString()` Get the string representation of this Resource.
    `protected java.io.InputStream` | `wrapStream(java.io.InputStream in)` Decompress on the fly.
    `protected java.io.OutputStream` | `wrapStream(java.io.OutputStream out)` Compress on the fly.

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

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

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

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

- - ### Constructor Detail

    - #### CommonsCompressCompressorResource

          protected CommonsCompressCompressorResource(java.lang.String name)

    - #### CommonsCompressCompressorResource

          protected CommonsCompressCompressorResource(java.lang.String name,
                                                      CompressorStreamFactory factory)

    - #### CommonsCompressCompressorResource

          protected CommonsCompressCompressorResource(java.lang.String name,
                                                      org.apache.tools.ant.types.ResourceCollection other)

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

    - #### CommonsCompressCompressorResource

          protected CommonsCompressCompressorResource(java.lang.String name,
                                                      CompressorStreamFactory factory,
                                                      org.apache.tools.ant.types.ResourceCollection other)

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

  - ### Method Detail

    - #### setFactory

          protected final void setFactory(CompressorStreamFactory factory)

      Since:
        Apache Compress Antlib 1.4

    - #### setDecompressConcatenated

          public void setDecompressConcatenated(boolean b)

      Whether to extract the whole resource if it contains multiple concatenated streams.

      Defaults to false for backwards compatibility.

      Since:
        Apache Compress Antlib 1.2

    - #### wrapStream

          protected final java.io.InputStream wrapStream(java.io.InputStream in)
                                                  throws java.io.IOException

      Decompress on the fly.
      Specified by:
        `wrapStream` in class `org.apache.tools.ant.types.resources.ContentTransformingResource`
      Parameters:
        `in` - the stream to wrap.
      Returns:
        the wrapped stream.
      Throws:
        `java.io.IOException` - if there is a problem.

    - #### wrapStream

          protected final java.io.OutputStream wrapStream(java.io.OutputStream out)
                                                   throws java.io.IOException

      Compress on the fly.
      Specified by:
        `wrapStream` in class `org.apache.tools.ant.types.resources.ContentTransformingResource`
      Parameters:
        `out` - the stream to wrap.
      Returns:
        the wrapped stream.
      Throws:
        `java.io.IOException` - if there is a problem.

    - #### toString

          public java.lang.String toString()

      Get the string representation of this Resource.
      Overrides:
        `toString` in class `org.apache.tools.ant.types.Resource`
      Returns:
        this Resource formatted as a String.