public class ZipGeneralPurposeBitFlags extends Object
Constructor and Description |
---|
ZipGeneralPurposeBitFlags()
Create a new general purpose bit flags object with all properties set to
false . |
ZipGeneralPurposeBitFlags(UnsignedShort s)
Create a new general purpose bit flags object that is initialized with
the contents of the supplied short object read from a Zip entry header.
|
Modifier and Type | Method and Description |
---|---|
boolean |
is3ShannonFanoTrees()
Bit 2: If the compression method used was type 6,
Imploding, then this bit, if set, indicates
3 Shannon-Fano trees were used to encode the
sliding dictionary output.
|
boolean |
is8kSlidingDictionary()
Bit 1: If the compression method used was type 6,
Imploding, then this bit, if set, indicates
an 8K sliding dictionary was used.
|
boolean |
isCompressedPatchedData()
Bit 5: If this bit is set, this indicates that the file is
compressed patched data.
|
boolean |
isEncrypted()
Bit 0: If set, indicates that the file is encrypted.
|
boolean |
isEosMarkerUsed()
(For Method 14 - LZMA)
Bit 1: If the compression method used was type 14,
LZMA, then this bit, if set, indicates
an end-of-stream (EOS) marker is used to
mark the end of the compressed data stream.
|
boolean |
isFastCompression()
(For Methods 8 and 9 - Deflating)
Bit 2 Bit 1
1 0 Fast (-ef) compression option was used.
|
boolean |
isLocalHeaderFieldZeroed()
Bit 3: If this bit is set, the fields crc-32, compressed
size and uncompressed size are set to zero in the
local header.
|
boolean |
isLocalHeaderValuesMasked()
Bit 13: Used when encrypting the Central Directory to indicate
selected data values in the Local Header are masked to
hide their actual values.
|
boolean |
isMaximumCompression()
(For Methods 8 and 9 - Deflating)
Bit 2 Bit 1
0 1 Maximum (-exx/-ex) compression option was used.
|
boolean |
isStrongEncryption()
Bit 6: Strong encryption.
|
boolean |
isSuperFastCompression()
(For Methods 8 and 9 - Deflating)
Bit 2 Bit 1
1 1 Super Fast (-es) compression option was used.
|
boolean |
isUtf8Encoding()
Bit 11: Language encoding flag (EFS).
|
void |
set3ShannonFanoTrees(boolean b) |
void |
set8kSlidingDictionary(boolean b) |
void |
setCompressedPatchedData(boolean b) |
void |
setEncrypted(boolean encrypted) |
void |
setEosMarkerUsed(boolean b) |
void |
setFastCompression(boolean b) |
void |
setLocalHeaderFieldsZeroed(boolean b) |
void |
setLocalHeaderValuesMasked(boolean b) |
void |
setMaximumCompression(boolean b) |
void |
setStrongEncryption(boolean b) |
void |
setSuperFastCompression(boolean b) |
void |
setUtf8Encoding(boolean b) |
byte[] |
toBytes(ZipEntryCompressionMethod cm)
Encode the bit flag values for storing them in a Zip file header.
|
public ZipGeneralPurposeBitFlags()
false
.public ZipGeneralPurposeBitFlags(UnsignedShort s)
s
- The short object containing data read from a Zip entry header.public boolean isEncrypted()
Bit 0: If set, indicates that the file is encrypted.
true
if the file is encrypted.public void setEncrypted(boolean encrypted)
public boolean is8kSlidingDictionary()
Bit 1: If the compression method used was type 6, Imploding, then this bit, if set, indicates an 8K sliding dictionary was used. If clear, then a 4K sliding dictionary was used.
true
if an 8k sliding dictionary was used.public void set8kSlidingDictionary(boolean b)
public boolean is3ShannonFanoTrees()
Bit 2: If the compression method used was type 6, Imploding, then this bit, if set, indicates 3 Shannon-Fano trees were used to encode the sliding dictionary output. If clear, then 2 Shannon-Fano trees were used.
true
if 3 Shannon-Fano trees were used.public void set3ShannonFanoTrees(boolean b)
public boolean isMaximumCompression()
(For Methods 8 and 9 - Deflating) Bit 2 Bit 1 0 1 Maximum (-exx/-ex) compression option was used.
true
if the maximum compression option was used.public void setMaximumCompression(boolean b)
public boolean isFastCompression()
(For Methods 8 and 9 - Deflating) Bit 2 Bit 1 1 0 Fast (-ef) compression option was used.
true
if the fast compression option was used.public void setFastCompression(boolean b)
public boolean isSuperFastCompression()
(For Methods 8 and 9 - Deflating) Bit 2 Bit 1 1 1 Super Fast (-es) compression option was used.
true
if the super fast compression option was used.public void setSuperFastCompression(boolean b)
public boolean isEosMarkerUsed()
(For Method 14 - LZMA) Bit 1: If the compression method used was type 14, LZMA, then this bit, if set, indicates an end-of-stream (EOS) marker is used to mark the end of the compressed data stream. If clear, then an EOS marker is not present and the compressed data size must be known to extract.
true
if an EOS marker is used.public void setEosMarkerUsed(boolean b)
public boolean isLocalHeaderFieldZeroed()
Bit 3: If this bit is set, the fields crc-32, compressed size and uncompressed size are set to zero in the local header. The correct values are put in the data descriptor immediately following the compressed data. (Note: PKZIP version 2.04g for DOS only recognizes this bit for method 8 compression, newer versions of PKZIP recognize this bit for any compression method.)
true
if the local header fields are zeroed.public void setLocalHeaderFieldsZeroed(boolean b)
public boolean isCompressedPatchedData()
Bit 5: If this bit is set, this indicates that the file is compressed patched data. (Note: Requires PKZIP version 2.70 or greater)
true
if the file is compressed patched data.public void setCompressedPatchedData(boolean b)
public boolean isStrongEncryption()
Bit 6: Strong encryption. If this bit is set, you should set the version needed to extract value to at least 50 and you must also set bit 0. If AES encryption is used, the version needed to extract value must be at least 51.
true
if strong encryption is used.public void setStrongEncryption(boolean b)
public boolean isUtf8Encoding()
Bit 11: Language encoding flag (EFS). If this bit is set, the filename and comment fields for this file must be encoded using UTF-8. (see APPENDIX D)
true
if UTF-8 encoding must be used.public void setUtf8Encoding(boolean b)
public boolean isLocalHeaderValuesMasked()
Bit 13: Used when encrypting the Central Directory to indicate selected data values in the Local Header are masked to hide their actual values. See the section describing the Strong Encryption Specification for details.
true
if selected local header data values are masked.public void setLocalHeaderValuesMasked(boolean b)
public byte[] toBytes(ZipEntryCompressionMethod cm)
cm
- The compression method used for the Zip file.