org.apache.commons.compress.archivers.sevenz

## Class SevenZArchiveEntry

- java.lang.Object
- - org.apache.commons.compress.archivers.sevenz.SevenZArchiveEntry

- All Implemented Interfaces:
    ArchiveEntry

      public class SevenZArchiveEntry
      extends Object
      implements ArchiveEntry

  An entry in a 7z archive.
  Since:
    1.6
  This class is not thread-safe

- - ### Field Summary

    - ### Fields inherited from interface org.apache.commons.compress.archivers.ArchiveEntry

      `SIZE_UNKNOWN`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SevenZArchiveEntry()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(Object obj)`
    `Date` | `getAccessDate()` Gets the access date.
    `FileTime` | `getAccessTime()` Gets the access time.
    `Iterable<? extends SevenZMethodConfiguration>` | `getContentMethods()` Gets the (compression) methods to use for entry's content - the default is LZMA2.
    `int` | `getCrc()` Deprecated. use getCrcValue instead.
    `long` | `getCrcValue()` Gets the CRC.
    `Date` | `getCreationDate()` Gets the creation date.
    `FileTime` | `getCreationTime()` Gets the creation time.
    `boolean` | `getHasAccessDate()` Gets whether this entry has got an access date at all.
    `boolean` | `getHasCrc()` Gets whether this entry has got a crc.
    `boolean` | `getHasCreationDate()` Gets whether this entry has got a creation date at all.
    `boolean` | `getHasLastModifiedDate()` Gets whether this entry has got a last modified date at all.
    `boolean` | `getHasWindowsAttributes()` Gets whether this entry has windows attributes.
    `Date` | `getLastModifiedDate()` Gets the last modified date.
    `FileTime` | `getLastModifiedTime()` Gets the last modified time.
    `String` | `getName()` Gets this entry's name.
    `long` | `getSize()` Gets this entry's file size.
    `int` | `getWindowsAttributes()` Gets the windows attributes.
    `int` | `hashCode()`
    `boolean` | `hasStream()` Whether there is any content associated with this entry.
    `boolean` | `isAntiItem()` Indicates whether this is an "anti-item" used in differential backups, meaning it should delete the same file from a previous backup.
    `boolean` | `isDirectory()` Return whether or not this entry represents a directory.
    `static long` | `javaTimeToNtfsTime(Date date)` Deprecated. Use `TimeUtils.toNtfsTime(Date)` instead.
    `static Date` | `ntfsTimeToJavaTime(long ntfsTime)` Deprecated. Use `TimeUtils.ntfsTimeToDate(long)` instead.
    `void` | `setAccessDate(Date accessDate)` Sets the access date.
    `void` | `setAccessDate(long ntfsAccessDate)` Sets the access date using NTFS time (100 nanosecond units since 1 January 1601)
    `void` | `setAccessTime(FileTime time)` Sets the access time.
    `void` | `setAntiItem(boolean isAntiItem)` Sets whether this is an "anti-item" used in differential backups, meaning it should delete the same file from a previous backup.
    `void` | `setContentMethods(Iterable<? extends SevenZMethodConfiguration> methods)` Sets the (compression) methods to use for entry's content - the default is LZMA2.
    `void` | `setContentMethods(SevenZMethodConfiguration... methods)` Sets the (compression) methods to use for entry's content - the default is LZMA2.
    `void` | `setCrc(int crc)` Deprecated. use setCrcValue instead.
    `void` | `setCrcValue(long crc)` Sets the CRC.
    `void` | `setCreationDate(Date creationDate)` Sets the creation date.
    `void` | `setCreationDate(long ntfsCreationDate)` Sets the creation date using NTFS time (100 nanosecond units since 1 January 1601)
    `void` | `setCreationTime(FileTime time)` Sets the creation time.
    `void` | `setDirectory(boolean isDirectory)` Sets whether or not this entry represents a directory.
    `void` | `setHasAccessDate(boolean hasAcessDate)` Sets whether this entry has got an access date at all.
    `void` | `setHasCrc(boolean hasCrc)` Sets whether this entry has got a crc.
    `void` | `setHasCreationDate(boolean hasCreationDate)` Sets whether this entry has got a creation date at all.
    `void` | `setHasLastModifiedDate(boolean hasLastModifiedDate)` Sets whether this entry has got a last modified date at all.
    `void` | `setHasStream(boolean hasStream)` Sets whether there is any content associated with this entry.
    `void` | `setHasWindowsAttributes(boolean hasWindowsAttributes)` Sets whether this entry has windows attributes.
    `void` | `setLastModifiedDate(Date lastModifiedDate)` Sets the last modified date.
    `void` | `setLastModifiedDate(long ntfsLastModifiedDate)` Sets the last modified date using NTFS time (100 nanosecond units since 1 January 1601)
    `void` | `setLastModifiedTime(FileTime time)` Sets the last modified time.
    `void` | `setName(String name)` Set this entry's name.
    `void` | `setSize(long size)` Set this entry's file size.
    `void` | `setWindowsAttributes(int windowsAttributes)` Sets the windows attributes.

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### SevenZArchiveEntry

          public SevenZArchiveEntry()

  - ### Method Detail

    - #### javaTimeToNtfsTime

          @Deprecated
          public static long javaTimeToNtfsTime(Date date)

      Deprecated. Use `TimeUtils.toNtfsTime(Date)` instead.
      Converts Java time to NTFS time.
      Parameters:
        `date` - the Java time
      Returns:
        the NTFS time
      See Also:
        `TimeUtils.toNtfsTime(Date)`

    - #### ntfsTimeToJavaTime

          @Deprecated
          public static Date ntfsTimeToJavaTime(long ntfsTime)

      Deprecated. Use `TimeUtils.ntfsTimeToDate(long)` instead.
      Converts NTFS time (100 nanosecond units since 1 January 1601) to Java time.
      Parameters:
        `ntfsTime` - the NTFS time in 100 nanosecond units
      Returns:
        the Java time
      See Also:
        `TimeUtils.ntfsTimeToDate(long)`

    - #### equals

          public boolean equals(Object obj)

      Overrides:
        `equals` in class `Object`

    - #### getAccessDate

          public Date getAccessDate()

      Gets the access date. This is equivalent to `getAccessTime()`, but precision is truncated to milliseconds.
      Returns:
        the access date
      Throws:
        `UnsupportedOperationException` - if the entry hasn't got an access date.
      See Also:
        `getAccessTime()`

    - #### getAccessTime

          public FileTime getAccessTime()

      Gets the access time.
      Returns:
        the access time
      Throws:
        `UnsupportedOperationException` - if the entry hasn't got an access time.
      Since:
        1.23

    - #### getContentMethods

          public Iterable<? extends SevenZMethodConfiguration> getContentMethods()

      Gets the (compression) methods to use for entry's content - the default is LZMA2.

      Currently only `SevenZMethod.COPY`, `SevenZMethod.LZMA2`, `SevenZMethod.BZIP2` and `SevenZMethod.DEFLATE` are supported when writing archives.

      The methods will be consulted in iteration order to create the final output.

      Returns:
        the methods to use for the content
      Since:
        1.8

    - #### getCrc

          @Deprecated
          public int getCrc()

      Deprecated. use getCrcValue instead.
      Gets the CRC.
      Returns:
        the CRC

    - #### getCrcValue

          public long getCrcValue()

      Gets the CRC.
      Returns:
        the CRC
      Since:
        1.7

    - #### getCreationDate

          public Date getCreationDate()

      Gets the creation date. This is equivalent to `getCreationTime()`, but precision is truncated to milliseconds.
      Returns:
        the new creation date
      Throws:
        `UnsupportedOperationException` - if the entry hasn't got a creation date.
      See Also:
        `getCreationTime()`

    - #### getCreationTime

          public FileTime getCreationTime()

      Gets the creation time.
      Returns:
        the creation time
      Throws:
        `UnsupportedOperationException` - if the entry hasn't got a creation time.
      Since:
        1.23

    - #### getHasAccessDate

          public boolean getHasAccessDate()

      Gets whether this entry has got an access date at all.
      Returns:
        whether this entry has got an access date at all.

    - #### getHasCrc

          public boolean getHasCrc()

      Gets whether this entry has got a crc.

      In general entries without streams don't have a CRC either.

      Returns:
        whether this entry has got a crc.

    - #### getHasCreationDate

          public boolean getHasCreationDate()

      Gets whether this entry has got a creation date at all.
      Returns:
        whether the entry has got a creation date

    - #### getHasLastModifiedDate

          public boolean getHasLastModifiedDate()

      Gets whether this entry has got a last modified date at all.
      Returns:
        whether this entry has got a last modified date at all

    - #### getHasWindowsAttributes

          public boolean getHasWindowsAttributes()

      Gets whether this entry has windows attributes.
      Returns:
        whether this entry has windows attributes.

    - #### getLastModifiedDate

          public Date getLastModifiedDate()

      Gets the last modified date. This is equivalent to `getLastModifiedTime()`, but precision is truncated to milliseconds.
      Specified by:
        `getLastModifiedDate` in interface `ArchiveEntry`
      Returns:
        the last modified date
      Throws:
        `UnsupportedOperationException` - if the entry hasn't got a last modified date.
      See Also:
        `getLastModifiedTime()`

    - #### getLastModifiedTime

          public FileTime getLastModifiedTime()

      Gets the last modified time.
      Returns:
        the last modified time
      Throws:
        `UnsupportedOperationException` - if the entry hasn't got a last modified time.
      Since:
        1.23

    - #### getName

          public String getName()

      Gets this entry's name.

      This method returns the raw name as it is stored inside of the archive.

      Specified by:
        `getName` in interface `ArchiveEntry`
      Returns:
        This entry's name.

    - #### getSize

          public long getSize()

      Gets this entry's file size.
      Specified by:
        `getSize` in interface `ArchiveEntry`
      Returns:
        This entry's file size.

    - #### getWindowsAttributes

          public int getWindowsAttributes()

      Gets the windows attributes.
      Returns:
        the windows attributes

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### hasStream

          public boolean hasStream()

      Whether there is any content associated with this entry.
      Returns:
        whether there is any content associated with this entry.

    - #### isAntiItem

          public boolean isAntiItem()

      Indicates whether this is an "anti-item" used in differential backups, meaning it should delete the same file from a previous backup.
      Returns:
        true if it is an anti-item, false otherwise

    - #### isDirectory

          public boolean isDirectory()

      Return whether or not this entry represents a directory.
      Specified by:
        `isDirectory` in interface `ArchiveEntry`
      Returns:
        True if this entry is a directory.

    - #### setAccessDate

          public void setAccessDate(Date accessDate)

      Sets the access date.
      Parameters:
        `accessDate` - the new access date
      See Also:
        `setAccessTime(FileTime)`

    - #### setAccessDate

          public void setAccessDate(long ntfsAccessDate)

      Sets the access date using NTFS time (100 nanosecond units since 1 January 1601)
      Parameters:
        `ntfsAccessDate` - the access date

    - #### setAccessTime

          public void setAccessTime(FileTime time)

      Sets the access time.
      Parameters:
        `time` - the new access time
      Since:
        1.23

    - #### setAntiItem

          public void setAntiItem(boolean isAntiItem)

      Sets whether this is an "anti-item" used in differential backups, meaning it should delete the same file from a previous backup.
      Parameters:
        `isAntiItem` - true if it is an anti-item, false otherwise

    - #### setContentMethods

          public void setContentMethods(Iterable<? extends SevenZMethodConfiguration> methods)

      Sets the (compression) methods to use for entry's content - the default is LZMA2.

      Currently only `SevenZMethod.COPY`, `SevenZMethod.LZMA2`, `SevenZMethod.BZIP2` and `SevenZMethod.DEFLATE` are supported when writing archives.

      The methods will be consulted in iteration order to create the final output.

      Parameters:
        `methods` - the methods to use for the content
      Since:
        1.8

    - #### setContentMethods

          public void setContentMethods(SevenZMethodConfiguration... methods)

      Sets the (compression) methods to use for entry's content - the default is LZMA2.

      Currently only `SevenZMethod.COPY`, `SevenZMethod.LZMA2`, `SevenZMethod.BZIP2` and `SevenZMethod.DEFLATE` are supported when writing archives.

      The methods will be consulted in iteration order to create the final output.

      Parameters:
        `methods` - the methods to use for the content
      Since:
        1.22

    - #### setCrc

          @Deprecated
          public void setCrc(int crc)

      Deprecated. use setCrcValue instead.
      Sets the CRC.
      Parameters:
        `crc` - the CRC

    - #### setCrcValue

          public void setCrcValue(long crc)

      Sets the CRC.
      Parameters:
        `crc` - the CRC
      Since:
        1.7

    - #### setCreationDate

          public void setCreationDate(Date creationDate)

      Sets the creation date.
      Parameters:
        `creationDate` - the new creation date
      See Also:
        `setCreationTime(FileTime)`

    - #### setCreationDate

          public void setCreationDate(long ntfsCreationDate)

      Sets the creation date using NTFS time (100 nanosecond units since 1 January 1601)
      Parameters:
        `ntfsCreationDate` - the creation date

    - #### setCreationTime

          public void setCreationTime(FileTime time)

      Sets the creation time.
      Parameters:
        `time` - the new creation time
      Since:
        1.23

    - #### setDirectory

          public void setDirectory(boolean isDirectory)

      Sets whether or not this entry represents a directory.
      Parameters:
        `isDirectory` - True if this entry is a directory.

    - #### setHasAccessDate

          public void setHasAccessDate(boolean hasAcessDate)

      Sets whether this entry has got an access date at all.
      Parameters:
        `hasAcessDate` - whether this entry has got an access date at all.

    - #### setHasCrc

          public void setHasCrc(boolean hasCrc)

      Sets whether this entry has got a crc.
      Parameters:
        `hasCrc` - whether this entry has got a crc.

    - #### setHasCreationDate

          public void setHasCreationDate(boolean hasCreationDate)

      Sets whether this entry has got a creation date at all.
      Parameters:
        `hasCreationDate` - whether the entry has got a creation date

    - #### setHasLastModifiedDate

          public void setHasLastModifiedDate(boolean hasLastModifiedDate)

      Sets whether this entry has got a last modified date at all.
      Parameters:
        `hasLastModifiedDate` - whether this entry has got a last modified date at all

    - #### setHasStream

          public void setHasStream(boolean hasStream)

      Sets whether there is any content associated with this entry.
      Parameters:
        `hasStream` - whether there is any content associated with this entry.

    - #### setHasWindowsAttributes

          public void setHasWindowsAttributes(boolean hasWindowsAttributes)

      Sets whether this entry has windows attributes.
      Parameters:
        `hasWindowsAttributes` - whether this entry has windows attributes.

    - #### setLastModifiedDate

          public void setLastModifiedDate(Date lastModifiedDate)

      Sets the last modified date.
      Parameters:
        `lastModifiedDate` - the new last modified date
      See Also:
        `setLastModifiedTime(FileTime)`

    - #### setLastModifiedDate

          public void setLastModifiedDate(long ntfsLastModifiedDate)

      Sets the last modified date using NTFS time (100 nanosecond units since 1 January 1601)
      Parameters:
        `ntfsLastModifiedDate` - the last modified date

    - #### setLastModifiedTime

          public void setLastModifiedTime(FileTime time)

      Sets the last modified time.
      Parameters:
        `time` - the new last modified time
      Since:
        1.23

    - #### setName

          public void setName(String name)

      Set this entry's name.
      Parameters:
        `name` - This entry's new name.

    - #### setSize

          public void setSize(long size)

      Set this entry's file size.
      Parameters:
        `size` - This entry's new file size.

    - #### setWindowsAttributes

          public void setWindowsAttributes(int windowsAttributes)

      Sets the windows attributes.
      Parameters:
        `windowsAttributes` - the windows attributes

Copyright © 2002–2022 The Apache Software Foundation. All rights reserved.