ZipArchiveEntry

Extension that adds better handling of extra fields and provides access to the internal and external file attributes.

The extra data is expected to follow the recommendation of APPNOTE.TXT:

  • the extra byte array consists of a sequence of extra fields
  • each extra fields starts by a two byte header id followed by a two byte sequence holding the length of the remainder of data.

Any extra data that cannot be parsed by the rules above will be consumed as "unparseable" extra data and treated differently by the methods of this class. Versions prior to Apache Commons Compress 1.1 would have thrown an exception if any attempt was made to read or write extra data not conforming to the recommendation.

Constructors

Link copied to clipboard
constructor(inputFile: File, entryName: String)
Creates a new ZIP entry taking some information from the given file and using the provided name.
constructor(entry: ZipEntry)
Creates a new ZIP entry with fields taken from the specified ZIP entry.
constructor(name: String)
Creates a new ZIP entry with the specified name.
constructor(entry: ZipArchiveEntry)
Creates a new ZIP entry with fields taken from the specified ZIP entry.

Types

Link copied to clipboard
Indicates how the comment of this entry has been determined.
Link copied to clipboard
How to try to parse the extra fields.
Link copied to clipboard
Indicates how the name of this entry has been determined.

Properties

Link copied to clipboard
protected open var alignment: Int
Link copied to clipboard
val CENATT: Int = 36
Link copied to clipboard
val CENATX: Int = 38
Link copied to clipboard
val CENCOM: Int = 32
Link copied to clipboard
val CENCRC: Int = 16
Link copied to clipboard
val CENDSK: Int = 34
Link copied to clipboard
val CENEXT: Int = 30
Link copied to clipboard
val CENFLG: Int = 8
Link copied to clipboard
val CENHDR: Int = 46
Link copied to clipboard
val CENHOW: Int = 10
Link copied to clipboard
val CENLEN: Int = 24
Link copied to clipboard
val CENNAM: Int = 28
Link copied to clipboard
val CENOFF: Int = 42
Link copied to clipboard
val CENSIG: Long = 33639248
Link copied to clipboard
val CENSIZ: Int = 20
Link copied to clipboard
val CENTIM: Int = 12
Link copied to clipboard
val CENVEM: Int = 4
Link copied to clipboard
val CENVER: Int = 6
Link copied to clipboard
Link copied to clipboard
val CRC_UNKNOWN: Int = -1
Link copied to clipboard
open var dataOffset: Long
Link copied to clipboard
val DEFLATED: Int = 8
Link copied to clipboard
Link copied to clipboard
val ENDCOM: Int = 20
Link copied to clipboard
val ENDHDR: Int = 22
Link copied to clipboard
val ENDOFF: Int = 16
Link copied to clipboard
val ENDSIG: Long = 101010256
Link copied to clipboard
val ENDSIZ: Int = 12
Link copied to clipboard
val ENDSUB: Int = 8
Link copied to clipboard
val ENDTOT: Int = 10
Link copied to clipboard
val EXTCRC: Int = 4
Link copied to clipboard
Link copied to clipboard
val EXTHDR: Int = 16
Link copied to clipboard
val EXTLEN: Int = 12
Link copied to clipboard
Link copied to clipboard
val EXTSIG: Long = 134695760
Link copied to clipboard
val EXTSIZ: Int = 8
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val LOCCRC: Int = 14
Link copied to clipboard
val LOCEXT: Int = 28
Link copied to clipboard
val LOCFLG: Int = 6
Link copied to clipboard
val LOCHDR: Int = 30
Link copied to clipboard
val LOCHOW: Int = 8
Link copied to clipboard
val LOCLEN: Int = 22
Link copied to clipboard
val LOCNAM: Int = 26
Link copied to clipboard
val LOCSIG: Long = 67324752
Link copied to clipboard
val LOCSIZ: Int = 18
Link copied to clipboard
val LOCTIM: Int = 10
Link copied to clipboard
val LOCVER: Int = 4
Link copied to clipboard
open var method: Int
The java.util.zip.ZipEntry base class only supports the compression methods STORED and DEFLATED.
Link copied to clipboard
open var name: String
Link copied to clipboard
Link copied to clipboard
Special value indicating that the offset is unknown.
Link copied to clipboard
open var platform: Int
Link copied to clipboard
val PLATFORM_FAT: Int = 0
Link copied to clipboard
Link copied to clipboard
open var rawFlag: Int
Link copied to clipboard
open val rawName: Array<Byte>
Link copied to clipboard
open var size: Long
The setSize method in the base class throws an IllegalArgumentException if the size is bigger than 2GB for Java versions <7 and even in Java 7+ if the implementation in java.util.zip doesn't support Zip64 itself (it is an optional feature).
Link copied to clipboard
val SIZE_UNKNOWN: Long = -1
Special value indicating that the size is unknown
Link copied to clipboard
val STORED: Int = 0
Link copied to clipboard
open var time: Long
Link copied to clipboard
open var versionMadeBy: Int
Link copied to clipboard

Functions

Link copied to clipboard
Adds an extra field - replacing an already present extra field of the same type.
Link copied to clipboard
Adds an extra field - replacing an already present extra field of the same type.
Link copied to clipboard
open fun clone(): Any
Overwrite clone.
Link copied to clipboard
open fun equals(obj: Any): Boolean
Link copied to clipboard
Retrieves the extra data for the central directory.
Link copied to clipboard
open fun getComment(): String
Link copied to clipboard
Link copied to clipboard
open fun getCrc(): Long
Link copied to clipboard
Link copied to clipboard
open fun getExtra(): Array<Byte>
Link copied to clipboard
Looks up an extra field by its header id.
Link copied to clipboard
open fun getExtraFields(includeUnparseable: Boolean): Array<ZipExtraField>
Retrieves extra fields.
Link copied to clipboard
The "general purpose bit" field.
Link copied to clipboard
Link copied to clipboard
Wraps getTime with a Date as the entry's last modified date.
Link copied to clipboard
Link copied to clipboard
Retrieves the extra data for the local file data.
Link copied to clipboard
open fun getMethod(): Int
Link copied to clipboard
open fun getName(): String
Link copied to clipboard
open fun getSize(): Long
Link copied to clipboard
open fun getTime(): Long
Link copied to clipboard
Link copied to clipboard
open fun getUnixMode(): Int
Unix permission.
Link copied to clipboard
open fun hashCode(): Int
Get the hash code of the entry.
Link copied to clipboard
open fun isDirectory(): Boolean
Is this entry a directory?
Link copied to clipboard
Returns true if this entry represents a unix symlink, in which case the entry's content contains the target path for the symlink.
Link copied to clipboard
open fun removeExtraField(type: ZipShort)
Remove an extra field.
Link copied to clipboard
Sets the central directory part of extra fields.
Link copied to clipboard
open fun setComment(comment: String)
Link copied to clipboard
open fun setCompressedSize(csize: Long)
Link copied to clipboard
open fun setCrc(crc: Long)
Link copied to clipboard
Link copied to clipboard
open fun setExtra(extra: Array<Byte>)
Parses the given bytes as extra field data and consumes any unparseable data as an UnparseableExtraFieldData instance.
Link copied to clipboard
The "general purpose bit" field.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun setMethod(method: Int)
Link copied to clipboard
open fun setSize(size: Long)
Link copied to clipboard
open fun setTime(time: Long)
Link copied to clipboard
open fun setTimeLocal(time: LocalDateTime)
Link copied to clipboard
open fun setUnixMode(mode: Int)
Sets Unix permissions in a way that is understood by Info-Zip's unzip command.
Link copied to clipboard
open fun toString(): String