Class SevenZArchiveEntry
- java.lang.Object
-
- org.apache.commons.compress.archivers.sevenz.SevenZArchiveEntry
-
- All Implemented Interfaces:
ArchiveEntry
public class SevenZArchiveEntry extends java.lang.Object implements ArchiveEntry
An entry in a 7z archive.- Since:
- 1.6
-
-
Field Summary
Fields Modifier and Type Field Description private long
accessDate
private long
compressedCrc
private long
compressedSize
private java.lang.Iterable<? extends SevenZMethodConfiguration>
contentMethods
private long
crc
private long
creationDate
private boolean
hasAccessDate
private boolean
hasCrc
private boolean
hasCreationDate
private boolean
hasLastModifiedDate
private boolean
hasStream
private boolean
hasWindowsAttributes
private boolean
isAntiItem
private boolean
isDirectory
private long
lastModifiedDate
private java.lang.String
name
private long
size
private int
windowsAttributes
-
Fields inherited from interface org.apache.commons.compress.archivers.ArchiveEntry
SIZE_UNKNOWN
-
-
Constructor Summary
Constructors Constructor Description SevenZArchiveEntry()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
private boolean
equalSevenZMethods(java.lang.Iterable<? extends SevenZMethodConfiguration> c1, java.lang.Iterable<? extends SevenZMethodConfiguration> c2)
java.util.Date
getAccessDate()
Gets the access date.(package private) int
getCompressedCrc()
Deprecated.use getCompressedCrcValue instead.(package private) long
getCompressedCrcValue()
Gets the compressed CRC.(package private) long
getCompressedSize()
Get this entry's compressed file size.java.lang.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.java.util.Date
getCreationDate()
Gets the creation date.boolean
getHasAccessDate()
Returns whether this entry has got an access date at all.boolean
getHasCrc()
Returns whether this entry has got a crc.boolean
getHasCreationDate()
Returns whether this entry has got a creation date at all.boolean
getHasLastModifiedDate()
Returns whether this entry has got a last modified date at all.boolean
getHasWindowsAttributes()
Returns whether this entry has windows attributes.java.util.Date
getLastModifiedDate()
Gets the last modified date.java.lang.String
getName()
Get this entry's name.long
getSize()
Get 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(java.util.Date date)
Converts Java time to NTFS time.static java.util.Date
ntfsTimeToJavaTime(long ntfsTime)
Converts NTFS time (100 nanosecond units since 1 January 1601) to Java time.void
setAccessDate(long ntfsAccessDate)
Sets the access date using NTFS time (100 nanosecond units since 1 January 1601)void
setAccessDate(java.util.Date accessDate)
Sets the access date,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.(package private) void
setCompressedCrc(int crc)
Deprecated.use setCompressedCrcValue instead.(package private) void
setCompressedCrcValue(long crc)
Sets the compressed CRC.(package private) void
setCompressedSize(long size)
Set this entry's compressed file size.void
setContentMethods(java.lang.Iterable<? extends 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(long ntfsCreationDate)
Sets the creation date using NTFS time (100 nanosecond units since 1 January 1601)void
setCreationDate(java.util.Date creationDate)
Sets the creation date,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(long ntfsLastModifiedDate)
Sets the last modified date using NTFS time (100 nanosecond units since 1 January 1601)void
setLastModifiedDate(java.util.Date lastModifiedDate)
Sets the last modified date,void
setName(java.lang.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.
-
-
-
Field Detail
-
name
private java.lang.String name
-
hasStream
private boolean hasStream
-
isDirectory
private boolean isDirectory
-
isAntiItem
private boolean isAntiItem
-
hasCreationDate
private boolean hasCreationDate
-
hasLastModifiedDate
private boolean hasLastModifiedDate
-
hasAccessDate
private boolean hasAccessDate
-
creationDate
private long creationDate
-
lastModifiedDate
private long lastModifiedDate
-
accessDate
private long accessDate
-
hasWindowsAttributes
private boolean hasWindowsAttributes
-
windowsAttributes
private int windowsAttributes
-
hasCrc
private boolean hasCrc
-
crc
private long crc
-
compressedCrc
private long compressedCrc
-
size
private long size
-
compressedSize
private long compressedSize
-
contentMethods
private java.lang.Iterable<? extends SevenZMethodConfiguration> contentMethods
-
-
Method Detail
-
getName
public java.lang.String getName()
Get this entry's name.This method returns the raw name as it is stored inside of the archive.
- Specified by:
getName
in interfaceArchiveEntry
- Returns:
- This entry's name.
-
setName
public void setName(java.lang.String name)
Set this entry's name.- Parameters:
name
- This entry's new name.
-
hasStream
public boolean hasStream()
Whether there is any content associated with this entry.- Returns:
- whether there is any content associated with this entry.
-
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.
-
isDirectory
public boolean isDirectory()
Return whether or not this entry represents a directory.- Specified by:
isDirectory
in interfaceArchiveEntry
- Returns:
- True if this entry is a directory.
-
setDirectory
public void setDirectory(boolean isDirectory)
Sets whether or not this entry represents a directory.- Parameters:
isDirectory
- True if this entry is a directory.
-
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
-
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
-
getHasCreationDate
public boolean getHasCreationDate()
Returns whether this entry has got a creation date at all.- Returns:
- whether the entry has got a creation date
-
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
-
getCreationDate
public java.util.Date getCreationDate()
Gets the creation date.- Returns:
- the creation date
- Throws:
java.lang.UnsupportedOperationException
- if the entry hasn't got a creation date.
-
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
-
setCreationDate
public void setCreationDate(java.util.Date creationDate)
Sets the creation date,- Parameters:
creationDate
- the creation date
-
getHasLastModifiedDate
public boolean getHasLastModifiedDate()
Returns whether this entry has got a last modified date at all.- Returns:
- whether this entry has got a last modified date at all
-
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
-
getLastModifiedDate
public java.util.Date getLastModifiedDate()
Gets the last modified date.- Specified by:
getLastModifiedDate
in interfaceArchiveEntry
- Returns:
- the last modified date
- Throws:
java.lang.UnsupportedOperationException
- if the entry hasn't got a last modified date.
-
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
-
setLastModifiedDate
public void setLastModifiedDate(java.util.Date lastModifiedDate)
Sets the last modified date,- Parameters:
lastModifiedDate
- the last modified date
-
getHasAccessDate
public boolean getHasAccessDate()
Returns whether this entry has got an access date at all.- Returns:
- whether this entry has got an access date at all.
-
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.
-
getAccessDate
public java.util.Date getAccessDate()
Gets the access date.- Returns:
- the access date
- Throws:
java.lang.UnsupportedOperationException
- if the entry hasn't got a access date.
-
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
-
setAccessDate
public void setAccessDate(java.util.Date accessDate)
Sets the access date,- Parameters:
accessDate
- the access date
-
getHasWindowsAttributes
public boolean getHasWindowsAttributes()
Returns whether this entry has windows attributes.- Returns:
- whether this entry has windows attributes.
-
setHasWindowsAttributes
public void setHasWindowsAttributes(boolean hasWindowsAttributes)
Sets whether this entry has windows attributes.- Parameters:
hasWindowsAttributes
- whether this entry has windows attributes.
-
getWindowsAttributes
public int getWindowsAttributes()
Gets the windows attributes.- Returns:
- the windows attributes
-
setWindowsAttributes
public void setWindowsAttributes(int windowsAttributes)
Sets the windows attributes.- Parameters:
windowsAttributes
- the windows attributes
-
getHasCrc
public boolean getHasCrc()
Returns 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.
-
setHasCrc
public void setHasCrc(boolean hasCrc)
Sets whether this entry has got a crc.- Parameters:
hasCrc
- whether this entry has got a crc.
-
getCrc
@Deprecated public int getCrc()
Deprecated.use getCrcValue instead.Gets the CRC.- Returns:
- the CRC
-
setCrc
@Deprecated public void setCrc(int crc)
Deprecated.use setCrcValue instead.Sets the CRC.- Parameters:
crc
- the CRC
-
getCrcValue
public long getCrcValue()
Gets the CRC.- Returns:
- the CRC
- Since:
- Compress 1.7
-
setCrcValue
public void setCrcValue(long crc)
Sets the CRC.- Parameters:
crc
- the CRC- Since:
- Compress 1.7
-
getCompressedCrc
@Deprecated int getCompressedCrc()
Deprecated.use getCompressedCrcValue instead.Gets the compressed CRC.- Returns:
- the compressed CRC
-
setCompressedCrc
@Deprecated void setCompressedCrc(int crc)
Deprecated.use setCompressedCrcValue instead.Sets the compressed CRC.- Parameters:
crc
- the CRC
-
getCompressedCrcValue
long getCompressedCrcValue()
Gets the compressed CRC.- Returns:
- the CRC
- Since:
- Compress 1.7
-
setCompressedCrcValue
void setCompressedCrcValue(long crc)
Sets the compressed CRC.- Parameters:
crc
- the CRC- Since:
- Compress 1.7
-
getSize
public long getSize()
Get this entry's file size.- Specified by:
getSize
in interfaceArchiveEntry
- Returns:
- This entry's file size.
-
setSize
public void setSize(long size)
Set this entry's file size.- Parameters:
size
- This entry's new file size.
-
getCompressedSize
long getCompressedSize()
Get this entry's compressed file size.- Returns:
- This entry's compressed file size.
-
setCompressedSize
void setCompressedSize(long size)
Set this entry's compressed file size.- Parameters:
size
- This entry's new compressed file size.
-
setContentMethods
public void setContentMethods(java.lang.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
andSevenZMethod.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
-
getContentMethods
public java.lang.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
andSevenZMethod.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
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
ntfsTimeToJavaTime
public static java.util.Date ntfsTimeToJavaTime(long ntfsTime)
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
-
javaTimeToNtfsTime
public static long javaTimeToNtfsTime(java.util.Date date)
Converts Java time to NTFS time.- Parameters:
date
- the Java time- Returns:
- the NTFS time
-
equalSevenZMethods
private boolean equalSevenZMethods(java.lang.Iterable<? extends SevenZMethodConfiguration> c1, java.lang.Iterable<? extends SevenZMethodConfiguration> c2)
-
-