public final class GeneralPurposeBit
extends java.lang.Object
implements java.lang.Cloneable
Modifier and Type | Field and Description |
---|---|
private static int |
DATA_DESCRIPTOR_FLAG
Indicates that a data descriptor stored after the file contents
will hold CRC and size information.
|
private boolean |
dataDescriptorFlag |
private static int |
ENCRYPTION_FLAG
Indicates that the file is encrypted.
|
private boolean |
encryptionFlag |
private boolean |
languageEncodingFlag |
private static int |
NUMBER_OF_SHANNON_FANO_TREES_FLAG
Indicates the number of Shannon-Fano trees used by the compression method 6 (imploding).
|
private int |
numberOfShannonFanoTrees |
private static int |
SLIDING_DICTIONARY_SIZE_FLAG
Indicates the size of the sliding dictionary used by the compression method 6 (imploding).
|
private int |
slidingDictionarySize |
private static int |
STRONG_ENCRYPTION_FLAG
Indicates strong encryption.
|
private boolean |
strongEncryptionFlag |
static int |
UFT8_NAMES_FLAG
Indicates that filenames are written in UTF-8.
|
Constructor and Description |
---|
GeneralPurposeBit() |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
clone() |
byte[] |
encode()
Encodes the set bits in a form suitable for ZIP archives.
|
void |
encode(byte[] buf,
int offset)
Encodes the set bits in a form suitable for ZIP archives.
|
boolean |
equals(java.lang.Object o) |
(package private) int |
getNumberOfShannonFanoTrees()
Returns the number of trees used by the compression method 6 (imploding).
|
(package private) int |
getSlidingDictionarySize()
Returns the sliding dictionary size used by the compression method 6 (imploding).
|
int |
hashCode() |
static GeneralPurposeBit |
parse(byte[] data,
int offset)
Parses the supported flags from the given archive data.
|
void |
useDataDescriptor(boolean b)
whether the current entry will use the data descriptor to store
CRC and size information.
|
void |
useEncryption(boolean b)
whether the current entry will be encrypted.
|
boolean |
usesDataDescriptor()
whether the current entry uses the data descriptor to store CRC
and size information.
|
boolean |
usesEncryption()
whether the current entry is encrypted.
|
boolean |
usesStrongEncryption()
whether the current entry is encrypted using strong encryption.
|
void |
useStrongEncryption(boolean b)
whether the current entry will be encrypted using strong encryption.
|
boolean |
usesUTF8ForNames()
whether the current entry uses UTF8 for file name and comment.
|
void |
useUTF8ForNames(boolean b)
whether the current entry will use UTF8 for file name and comment.
|
private static final int ENCRYPTION_FLAG
private static final int SLIDING_DICTIONARY_SIZE_FLAG
private static final int NUMBER_OF_SHANNON_FANO_TREES_FLAG
private static final int DATA_DESCRIPTOR_FLAG
private static final int STRONG_ENCRYPTION_FLAG
public static final int UFT8_NAMES_FLAG
The only reason this is public is that ZipArchiveOutputStream.EFS_FLAG
was public in Apache Commons
Compress 1.0 and we needed a substitute for it.
private boolean languageEncodingFlag
private boolean dataDescriptorFlag
private boolean encryptionFlag
private boolean strongEncryptionFlag
private int slidingDictionarySize
private int numberOfShannonFanoTrees
public boolean usesUTF8ForNames()
public void useUTF8ForNames(boolean b)
b
- whether the current entry will use UTF8 for file name and comment.public boolean usesDataDescriptor()
public void useDataDescriptor(boolean b)
b
- whether the current entry will use the data descriptor to store
CRC and size informationpublic boolean usesEncryption()
public void useEncryption(boolean b)
b
- whether the current entry will be encryptedpublic boolean usesStrongEncryption()
public void useStrongEncryption(boolean b)
b
- whether the current entry will be encrypted using strong encryptionint getSlidingDictionarySize()
int getNumberOfShannonFanoTrees()
public byte[] encode()
public void encode(byte[] buf, int offset)
buf
- the output bufferoffset
- The offset within the output buffer of the first byte to be written.
must be non-negative and no larger than buf.length-2public static GeneralPurposeBit parse(byte[] data, int offset)
data
- local file header or a central directory entry.offset
- offset at which the general purpose bit startspublic int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public java.lang.Object clone()
clone
in class java.lang.Object