org.apache.ant.compress.resources

## Class SevenZResource

- 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.ArchiveResource
        - - org.apache.ant.compress.resources.CommonsCompressArchiveResource
          - - org.apache.ant.compress.resources.SevenZResource

- 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

      public final class SevenZResource
      extends CommonsCompressArchiveResource

  A Resource representation of an entry in a sevenzfile.
  Since:
    Apache Compress Antlib 1.3

- - ### 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 and Description
    `SevenZResource()` Default constructor.
    `SevenZResource(java.io.File z, java.lang.String enc, org.apache.commons.compress.archivers.sevenz.SevenZArchiveEntry e)` Construct a SevenZResource representing the specified entry in the specified 7z file.
    `SevenZResource(org.apache.tools.ant.types.Resource z, java.lang.String enc, org.apache.commons.compress.archivers.sevenz.SevenZArchiveEntry e)` Construct a SevenZResource representing the specified entry in the specified 7z archive.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `fetchEntry()` fetches information from the named entry inside the archive.
    `java.lang.Iterable` | `getContentMethods()` Gets the (compression) methods to used for entry's content.
    `java.io.InputStream` | `getInputStream()` Return an InputStream for reading the contents of this Resource.
    `java.io.File` | `getSevenZFile()` Get the 7z file that holds this SevenZResource.
    `protected void` | `setEntry(org.apache.commons.compress.archivers.ArchiveEntry e)`
    `void` | `setSevenZFile(java.io.File z)` Set the 7z that holds this SevenZResource.
    `void` | `setSevenZResource(org.apache.tools.ant.types.Resource z)` Set the 7z file that holds this SevenZResource.

    - ### Methods inherited from class org.apache.ant.compress.resources.CommonsCompressArchiveResource

      `getEncoding, getGid, getOutputStream, getUid, setEncoding, setRefid`

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

      `addConfigured, checkEntry, compareTo, dieOnCircularReference, equals, getArchive, getLastModified, getMode, getSize, hashCode, isDirectory, isExists, setArchive, setMode, toString`

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

      `as, clone, getMagicNumber, getName, isFilesystemOnly, iterator, setDirectory, setExists, setLastModified, setName, setSize, 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

    - #### SevenZResource

          public SevenZResource()

      Default constructor.

    - #### SevenZResource

          public SevenZResource(java.io.File z,
                                java.lang.String enc,
                                org.apache.commons.compress.archivers.sevenz.SevenZArchiveEntry e)

      Construct a SevenZResource representing the specified entry in the specified 7z file.
      Parameters:
        `z` - the 7z file as File.
        `enc` - the encoding used for filenames - ignored.
        `e` - the SevenZEntry.

    - #### SevenZResource

          public SevenZResource(org.apache.tools.ant.types.Resource z,
                                java.lang.String enc,
                                org.apache.commons.compress.archivers.sevenz.SevenZArchiveEntry e)

      Construct a SevenZResource representing the specified entry in the specified 7z archive.
      Parameters:
        `z` - the 7z archive
        `enc` - the encoding used for filenames - ignored.
        `e` - the SevenZEntry.

  - ### Method Detail

    - #### setSevenZFile

          public void setSevenZFile(java.io.File z)

      Set the 7z that holds this SevenZResource.
      Parameters:
        `z` - the 7z file as a File.

    - #### setSevenZResource

          public void setSevenZResource(org.apache.tools.ant.types.Resource z)

      Set the 7z file that holds this SevenZResource.
      Parameters:
        `z` - the 7z as a Resource.

    - #### getSevenZFile

          public java.io.File getSevenZFile()

      Get the 7z file that holds this SevenZResource.
      Returns:
        the 7z file as a File or null if it is not a file.

    - #### getInputStream

          public java.io.InputStream getInputStream()
                                             throws java.io.IOException

      Return an InputStream for reading the contents of this Resource.
      Overrides:
        `getInputStream` in class `CommonsCompressArchiveResource`
      Returns:
        an InputStream object.
      Throws:
        `java.io.IOException` - if the sevenz file cannot be opened, or the entry cannot be read.

    - #### getContentMethods

          public java.lang.Iterable getContentMethods()

      Gets the (compression) methods to used for entry's content.
      Since:
        1.5

    - #### fetchEntry

          protected void fetchEntry()

      fetches information from the named entry inside the archive.
      Overrides:
        `fetchEntry` in class `CommonsCompressArchiveResource`

    - #### setEntry

          protected void setEntry(org.apache.commons.compress.archivers.ArchiveEntry e)

      Overrides:
        `setEntry` in class `CommonsCompressArchiveResource`