Top Description Fields Constructors Methods
org.apache.commons.compress.archivers.sevenz

public Class SevenZArchiveEntry

extends Object
implements ArchiveEntry
Class Inheritance
All Implemented Interfaces
org.apache.commons.compress.archivers.ArchiveEntry
Imports
java.nio.file.attribute.FileTime, java.util.Arrays, .Collections, .Date, .Iterator, .LinkedList, .Objects, org.apache.commons.compress.archivers.ArchiveEntry, org.apache.commons.io.file.attribute.FileTimes

An entry in a 7z archive.
Since
1.6

Field Summary

Modifier and TypeField and Description
private FileTime
private long
private long
private Iterable<? extends SevenZMethodConfiguration>
private long
private FileTime
pack-priv static final SevenZArchiveEntry[]
private boolean
private boolean
private boolean
private boolean
private boolean
private boolean
private boolean
private boolean
private FileTime
private String
private long
private int

Constructor Summary

AccessConstructor and Description
public
SevenZArchiveEntry()

Constructs a new instance.

Method Summary

Modifier and TypeMethod and Description
public boolean
equals(final Object
the reference object with which to compare.
obj
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.
private boolean
public Date

Returns:

the access date
getAccessDate
()

Gets the access date.

public FileTime

Returns:

the access time
getAccessTime
()

Gets the access time.

pack-priv int

Returns:

the compressed CRC
getCompressedCrc
()

Deprecated Use getCompressedCrcValue() instead.
Gets the compressed CRC.
pack-priv long

Returns:

the CRC
getCompressedCrcValue
()

Gets the compressed CRC.

pack-priv long

Returns:

This entry's compressed file size.
getCompressedSize
()

Gets this entry's compressed file size.

public Iterable<? extends SevenZMethodConfiguration>

Returns:

the methods to use for the content
getContentMethods
()

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

public int

Returns:

the CRC
getCrc
()

Deprecated use getCrcValue instead.
Gets the CRC.
public long

Returns:

the CRC
getCrcValue
()

Gets the CRC.

public Date

Returns:

the new creation date
getCreationDate
()

Gets the creation date.

public FileTime

Returns:

the creation time
getCreationTime
()

Gets the creation time.

public boolean

Returns:

whether this entry has got an access date at all.
getHasAccessDate
()

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

public boolean

Returns:

whether this entry has got a crc.
getHasCrc
()

Gets whether this entry has got a crc.

public boolean

Returns:

whether the entry has got a creation date
getHasCreationDate
()

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

public boolean

Returns:

whether this entry has got a last modified date at all
getHasLastModifiedDate
()

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

public boolean

Returns:

whether this entry has windows attributes.
getHasWindowsAttributes
()

Gets whether this entry has windows attributes.

public Date

Returns:

the last modified date
getLastModifiedDate
()

Implements org.apache.commons.compress.archivers.ArchiveEntry.getLastModifiedDate.

Gets the last modified date.
public FileTime

Returns:

the last modified time
getLastModifiedTime
()

Gets the last modified time.

public String

Returns:

This entry's name.
getName
()

Implements org.apache.commons.compress.archivers.ArchiveEntry.getName.

Gets this entry's name.
public long

Returns:

This entry's file size.
getSize
()

Implements org.apache.commons.compress.archivers.ArchiveEntry.getSize.

Gets this entry's file size.
public int

Returns:

the windows attributes
getWindowsAttributes
()

Gets the windows attributes.

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for the object.
public boolean

Returns:

whether there is any content associated with this entry.
hasStream
()

Tests whether there is any content associated with this entry.

public boolean

Returns:

true if it is an anti-item, false otherwise
isAntiItem
()

Tests whether this is an "anti-item" used in differential backups, meaning it should delete the same file from a previous backup.

public boolean

Returns:

True if this entry is a directory.
isDirectory
()

Implements org.apache.commons.compress.archivers.ArchiveEntry.isDirectory.

Tests whether or not this entry represents a directory.
public static long

Returns:

the NTFS time
javaTimeToNtfsTime
(final Date
the Java time
date
)

Deprecated Use FileTimes#toNtfsTime(Date) instead.
Converts Java time to NTFS time.
public static Date

Returns:

the Java time
ntfsTimeToJavaTime
(final long
the NTFS time in 100 nanosecond units
ntfsTime
)

Deprecated Use FileTimes#ntfsTimeToDate(long) instead.
Converts NTFS time (100 nanosecond units since 1 January 1601) to Java time.
public void
setAccessDate(final Date
the new access date
accessDate
)

Sets the access date.

public void
setAccessDate(final long
the access date
ntfsAccessDate
)

Sets the access date using NTFS time (100 nanosecond units since 1 January 1601)

public void
setAccessTime(final FileTime
the new access time
time
)

Sets the access time.

public void
setAntiItem(final boolean
true if it is an anti-item, false otherwise
isAntiItem
)

Sets whether this is an "anti-item" used in differential backups, meaning it should delete the same file from a previous backup.

pack-priv void
setCompressedCrc(final int
the CRC
crc
)

Deprecated use setCompressedCrcValue instead.
Sets the compressed CRC.
pack-priv void
setCompressedCrcValue(final long
the CRC
crc
)

Sets the compressed CRC.

pack-priv void
setCompressedSize(final long
This entry's new compressed file size.
size
)

Sets this entry's compressed file size.

public void
setContentMethods(final Iterable<? extends SevenZMethodConfiguration>
the methods to use for the content
methods
)

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

public void
setContentMethods(final SevenZMethodConfiguration...
the methods to use for the content
methods
)

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

public void
setCrc(final int
the CRC
crc
)

Deprecated use setCrcValue instead.
Sets the CRC.
public void
setCrcValue(final long
the CRC
crc
)

Sets the CRC.

public void
setCreationDate(final Date
the new creation date
creationDate
)

Sets the creation date.

public void
setCreationDate(final long
the creation date
ntfsCreationDate
)

Sets the creation date using NTFS time (100 nanosecond units since 1 January 1601)

public void
setCreationTime(final FileTime
the new creation time
time
)

Sets the creation time.

public void
setDirectory(final boolean
True if this entry is a directory.
isDirectory
)

Sets whether or not this entry represents a directory.

public void
setHasAccessDate(final boolean
whether this entry has got an access date at all.
hasAcessDate
)

Sets whether this entry has got an access date at all.

public void
setHasCrc(final boolean
whether this entry has got a crc.
hasCrc
)

Sets whether this entry has got a crc.

public void
setHasCreationDate(final boolean
whether the entry has got a creation date
hasCreationDate
)

Sets whether this entry has got a creation date at all.

public void
setHasLastModifiedDate(final boolean
whether this entry has got a last modified date at all
hasLastModifiedDate
)

Sets whether this entry has got a last modified date at all.

public void
setHasStream(final boolean
whether there is any content associated with this entry.
hasStream
)

Sets whether there is any content associated with this entry.

public void
setHasWindowsAttributes(final boolean
whether this entry has windows attributes.
hasWindowsAttributes
)

Sets whether this entry has windows attributes.

public void
setLastModifiedDate(final Date
the new last modified date
lastModifiedDate
)

Sets the last modified date.

public void
setLastModifiedDate(final long
the last modified date
ntfsLastModifiedDate
)

Sets the last modified date using NTFS time (100 nanosecond units since 1 January 1601)

public void
setLastModifiedTime(final FileTime
the new last modified time
time
)

Sets the last modified time.

public void
setName(final String
This entry's new name.
name
)

Sets this entry's name.

public void
setSize(final long
This entry's new file size.
size
)

Sets this entry's file size.

public void
setWindowsAttributes(final int
the windows attributes
windowsAttributes
)

Sets the windows attributes.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAlltoStringwaitwaitwait

Field Detail

accessDateback to summary
private FileTime accessDate
compressedCrcback to summary
private long compressedCrc
compressedSizeback to summary
private long compressedSize
contentMethodsback to summary
private Iterable<? extends SevenZMethodConfiguration> contentMethods
crcback to summary
private long crc
creationDateback to summary
private FileTime creationDate
EMPTY_SEVEN_Z_ARCHIVE_ENTRY_ARRAYback to summary
pack-priv static final SevenZArchiveEntry[] EMPTY_SEVEN_Z_ARCHIVE_ENTRY_ARRAY
hasAccessDateback to summary
private boolean hasAccessDate
hasCrcback to summary
private boolean hasCrc
hasCreationDateback to summary
private boolean hasCreationDate
hasLastModifiedDateback to summary
private boolean hasLastModifiedDate
hasStreamback to summary
private boolean hasStream
hasWindowsAttributesback to summary
private boolean hasWindowsAttributes
isAntiItemback to summary
private boolean isAntiItem
isDirectoryback to summary
private boolean isDirectory
lastModifiedDateback to summary
private FileTime lastModifiedDate
nameback to summary
private String name
sizeback to summary
private long size
windowsAttributesback to summary
private int windowsAttributes

Constructor Detail

SevenZArchiveEntryback to summary
public SevenZArchiveEntry()

Constructs a new instance.

Method Detail

equalsback to summary
public boolean equals(final Object obj)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
obj:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
equalSevenZMethodsback to summary
private boolean equalSevenZMethods(final Iterable<? extends SevenZMethodConfiguration> c1, final Iterable<? extends SevenZMethodConfiguration> c2)
getAccessDateback to summary
public Date getAccessDate()

Gets the access date. This is equivalent to SevenZArchiveEntry#getAccessTime(), but precision is truncated to milliseconds.

Returns:Date

the access date

Exceptions
UnsupportedOperationException:
if the entry hasn't got an access date.
See Also
SevenZArchiveEntry#getAccessTime()
getAccessTimeback to summary
public FileTime getAccessTime()

Gets the access time.

Returns:FileTime

the access time

Exceptions
UnsupportedOperationException:
if the entry hasn't got an access time.
Since
1.23
getCompressedCrcback to summary
pack-priv int getCompressedCrc()

Deprecated

Use getCompressedCrcValue() instead.

Gets the compressed CRC.

Returns:int

the compressed CRC

Annotations
@Deprecated
getCompressedCrcValueback to summary
pack-priv long getCompressedCrcValue()

Gets the compressed CRC.

Returns:long

the CRC

Since
1.7
getCompressedSizeback to summary
pack-priv long getCompressedSize()

Gets this entry's compressed file size.

Returns:long

This entry's compressed file size.

getContentMethodsback to summary
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:Iterable<? extends SevenZMethodConfiguration>

the methods to use for the content

Since
1.8
getCrcback to summary
public int getCrc()

Deprecated

use getCrcValue instead.

Gets the CRC.

Returns:int

the CRC

Annotations
@Deprecated
getCrcValueback to summary
public long getCrcValue()

Gets the CRC.

Returns:long

the CRC

Since
1.7
getCreationDateback to summary
public Date getCreationDate()

Gets the creation date. This is equivalent to SevenZArchiveEntry#getCreationTime(), but precision is truncated to milliseconds.

Returns:Date

the new creation date

Exceptions
UnsupportedOperationException:
if the entry hasn't got a creation date.
See Also
SevenZArchiveEntry#getCreationTime()
getCreationTimeback to summary
public FileTime getCreationTime()

Gets the creation time.

Returns:FileTime

the creation time

Exceptions
UnsupportedOperationException:
if the entry hasn't got a creation time.
Since
1.23
getHasAccessDateback to summary
public boolean getHasAccessDate()

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

Returns:boolean

whether this entry has got an access date at all.

getHasCrcback to summary
public boolean getHasCrc()

Gets whether this entry has got a crc.

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

Returns:boolean

whether this entry has got a crc.

getHasCreationDateback to summary
public boolean getHasCreationDate()

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

Returns:boolean

whether the entry has got a creation date

getHasLastModifiedDateback to summary
public boolean getHasLastModifiedDate()

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

Returns:boolean

whether this entry has got a last modified date at all

getHasWindowsAttributesback to summary
public boolean getHasWindowsAttributes()

Gets whether this entry has windows attributes.

Returns:boolean

whether this entry has windows attributes.

getLastModifiedDateback to summary
public Date getLastModifiedDate()

Implements org.apache.commons.compress.archivers.ArchiveEntry.getLastModifiedDate.

Gets the last modified date. This is equivalent to SevenZArchiveEntry#getLastModifiedTime(), but precision is truncated to milliseconds.

Returns:Date

the last modified date

Annotations
@Override
Exceptions
UnsupportedOperationException:
if the entry hasn't got a last modified date.
See Also
SevenZArchiveEntry#getLastModifiedTime()
getLastModifiedTimeback to summary
public FileTime getLastModifiedTime()

Gets the last modified time.

Returns:FileTime

the last modified time

Exceptions
UnsupportedOperationException:
if the entry hasn't got a last modified time.
Since
1.23
getNameback to summary
public String getName()

Implements org.apache.commons.compress.archivers.ArchiveEntry.getName.

Gets this entry's name.

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

Returns:String

This entry's name.

Annotations
@Override
getSizeback to summary
public long getSize()

Implements org.apache.commons.compress.archivers.ArchiveEntry.getSize.

Gets this entry's file size.

Returns:long

This entry's file size.

Annotations
@Override
getWindowsAttributesback to summary
public int getWindowsAttributes()

Gets the windows attributes.

Returns:int

the windows attributes

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object.

Annotations
@Override
hasStreamback to summary
public boolean hasStream()

Tests whether there is any content associated with this entry.

Returns:boolean

whether there is any content associated with this entry.

isAntiItemback to summary
public boolean isAntiItem()

Tests whether this is an "anti-item" used in differential backups, meaning it should delete the same file from a previous backup.

Returns:boolean

true if it is an anti-item, false otherwise

isDirectoryback to summary
public boolean isDirectory()

Implements org.apache.commons.compress.archivers.ArchiveEntry.isDirectory.

Tests whether or not this entry represents a directory.

Returns:boolean

True if this entry is a directory.

Annotations
@Override
javaTimeToNtfsTimeback to summary
public static long javaTimeToNtfsTime(final Date date)

Deprecated

Use FileTimes#toNtfsTime(Date) instead.

Converts Java time to NTFS time.

Parameters
date:Date

the Java time

Returns:long

the NTFS time

Annotations
@Deprecated
See Also
FileTimes#toNtfsTime(Date)
ntfsTimeToJavaTimeback to summary
public static Date ntfsTimeToJavaTime(final long ntfsTime)

Deprecated

Use FileTimes#ntfsTimeToDate(long) instead.

Converts NTFS time (100 nanosecond units since 1 January 1601) to Java time.

Parameters
ntfsTime:long

the NTFS time in 100 nanosecond units

Returns:Date

the Java time

Annotations
@Deprecated
See Also
FileTimes#ntfsTimeToDate(long)
setAccessDateback to summary
public void setAccessDate(final Date accessDate)

Sets the access date.

Parameters
accessDate:Date

the new access date

See Also
SevenZArchiveEntry#setAccessTime(FileTime)
setAccessDateback to summary
public void setAccessDate(final long ntfsAccessDate)

Sets the access date using NTFS time (100 nanosecond units since 1 January 1601)

Parameters
ntfsAccessDate:long

the access date

setAccessTimeback to summary
public void setAccessTime(final FileTime time)

Sets the access time.

Parameters
time:FileTime

the new access time

Since
1.23
setAntiItemback to summary
public void setAntiItem(final 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:boolean

true if it is an anti-item, false otherwise

setCompressedCrcback to summary
pack-priv void setCompressedCrc(final int crc)

Deprecated

use setCompressedCrcValue instead.

Sets the compressed CRC.

Parameters
crc:int

the CRC

Annotations
@Deprecated
setCompressedCrcValueback to summary
pack-priv void setCompressedCrcValue(final long crc)

Sets the compressed CRC.

Parameters
crc:long

the CRC

Since
1.7
setCompressedSizeback to summary
pack-priv void setCompressedSize(final long size)

Sets this entry's compressed file size.

Parameters
size:long

This entry's new compressed file size.

setContentMethodsback to summary
public void setContentMethods(final 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:Iterable<? extends SevenZMethodConfiguration>

the methods to use for the content

Since
1.8
setContentMethodsback to summary
public void setContentMethods(final 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:SevenZMethodConfiguration[]

the methods to use for the content

Since
1.22
setCrcback to summary
public void setCrc(final int crc)

Deprecated

use setCrcValue instead.

Sets the CRC.

Parameters
crc:int

the CRC

Annotations
@Deprecated
setCrcValueback to summary
public void setCrcValue(final long crc)

Sets the CRC.

Parameters
crc:long

the CRC

Since
1.7
setCreationDateback to summary
public void setCreationDate(final Date creationDate)

Sets the creation date.

Parameters
creationDate:Date

the new creation date

See Also
SevenZArchiveEntry#setCreationTime(FileTime)
setCreationDateback to summary
public void setCreationDate(final long ntfsCreationDate)

Sets the creation date using NTFS time (100 nanosecond units since 1 January 1601)

Parameters
ntfsCreationDate:long

the creation date

setCreationTimeback to summary
public void setCreationTime(final FileTime time)

Sets the creation time.

Parameters
time:FileTime

the new creation time

Since
1.23
setDirectoryback to summary
public void setDirectory(final boolean isDirectory)

Sets whether or not this entry represents a directory.

Parameters
isDirectory:boolean

True if this entry is a directory.

setHasAccessDateback to summary
public void setHasAccessDate(final boolean hasAcessDate)

Sets whether this entry has got an access date at all.

Parameters
hasAcessDate:boolean

whether this entry has got an access date at all.

setHasCrcback to summary
public void setHasCrc(final boolean hasCrc)

Sets whether this entry has got a crc.

Parameters
hasCrc:boolean

whether this entry has got a crc.

setHasCreationDateback to summary
public void setHasCreationDate(final boolean hasCreationDate)

Sets whether this entry has got a creation date at all.

Parameters
hasCreationDate:boolean

whether the entry has got a creation date

setHasLastModifiedDateback to summary
public void setHasLastModifiedDate(final boolean hasLastModifiedDate)

Sets whether this entry has got a last modified date at all.

Parameters
hasLastModifiedDate:boolean

whether this entry has got a last modified date at all

setHasStreamback to summary
public void setHasStream(final boolean hasStream)

Sets whether there is any content associated with this entry.

Parameters
hasStream:boolean

whether there is any content associated with this entry.

setHasWindowsAttributesback to summary
public void setHasWindowsAttributes(final boolean hasWindowsAttributes)

Sets whether this entry has windows attributes.

Parameters
hasWindowsAttributes:boolean

whether this entry has windows attributes.

setLastModifiedDateback to summary
public void setLastModifiedDate(final Date lastModifiedDate)

Sets the last modified date.

Parameters
lastModifiedDate:Date

the new last modified date

See Also
SevenZArchiveEntry#setLastModifiedTime(FileTime)
setLastModifiedDateback to summary
public void setLastModifiedDate(final long ntfsLastModifiedDate)

Sets the last modified date using NTFS time (100 nanosecond units since 1 January 1601)

Parameters
ntfsLastModifiedDate:long

the last modified date

setLastModifiedTimeback to summary
public void setLastModifiedTime(final FileTime time)

Sets the last modified time.

Parameters
time:FileTime

the new last modified time

Since
1.23
setNameback to summary
public void setName(final String name)

Sets this entry's name.

Parameters
name:String

This entry's new name.

setSizeback to summary
public void setSize(final long size)

Sets this entry's file size.

Parameters
size:long

This entry's new file size.

setWindowsAttributesback to summary
public void setWindowsAttributes(final int windowsAttributes)

Sets the windows attributes.

Parameters
windowsAttributes:int

the windows attributes