Class GeneralPurposeBit
java.lang.Object
org.apache.commons.compress.archivers.zip.GeneralPurposeBit
- All Implemented Interfaces:
Cloneable
Parser/encoder for the "general purpose bit" field in ZIP's local file and central directory headers.
- Since:
- 1.1
- This class is not thread-safe
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intIndicates that file names are written in UTF-8. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()byte[]encode()Encodes the set bits in a form suitable for ZIP archives.voidencode(byte[] buf, int offset) Encodes the set bits in a form suitable for ZIP archives.booleaninthashCode()static GeneralPurposeBitparse(byte[] data, int offset) Parses the supported flags from the given archive data.voiduseDataDescriptor(boolean b) whether the current entry will use the data descriptor to store CRC and size information.voiduseEncryption(boolean b) whether the current entry will be encrypted.booleanwhether the current entry uses the data descriptor to store CRC and size information.booleanwhether the current entry is encrypted.booleanwhether the current entry is encrypted using strong encryption.voiduseStrongEncryption(boolean b) whether the current entry will be encrypted using strong encryption.booleanwhether the current entry uses UTF8 for file name and comment.voiduseUTF8ForNames(boolean b) whether the current entry will use UTF8 for file name and comment.
-
Field Details
-
UFT8_NAMES_FLAG
Indicates that file names are written in UTF-8.The only reason this is public is that
ZipArchiveOutputStream.EFS_FLAGwas public in Apache Commons Compress 1.0 and we needed a substitute for it.- See Also:
-
-
Constructor Details
-
GeneralPurposeBit
public GeneralPurposeBit()
-
-
Method Details
-
parse
Parses the supported flags from the given archive data.- Parameters:
data- local file header or a central directory entry.offset- offset at which the general purpose bit starts- Returns:
- parsed flags
-
clone
-
encode
Encodes the set bits in a form suitable for ZIP archives.- Returns:
- the encoded general purpose bits
-
encode
Encodes the set bits in a form suitable for ZIP archives.- Parameters:
buf- the output bufferoffset- The offset within the output buffer of the first byte to be written. must be non-negative and no larger thanbuf.length-2
-
equals
-
hashCode
-
useDataDescriptor
whether the current entry will use the data descriptor to store CRC and size information.- Parameters:
b- whether the current entry will use the data descriptor to store CRC and size information
-
useEncryption
whether the current entry will be encrypted.- Parameters:
b- whether the current entry will be encrypted
-
usesDataDescriptor
whether the current entry uses the data descriptor to store CRC and size information.- Returns:
- whether the current entry uses the data descriptor to store CRC and size information
-
usesEncryption
whether the current entry is encrypted.- Returns:
- whether the current entry is encrypted
-
usesStrongEncryption
whether the current entry is encrypted using strong encryption.- Returns:
- whether the current entry is encrypted using strong encryption
-
useStrongEncryption
whether the current entry will be encrypted using strong encryption.- Parameters:
b- whether the current entry will be encrypted using strong encryption
-
usesUTF8ForNames
whether the current entry uses UTF8 for file name and comment.- Returns:
- whether the current entry uses UTF8 for file name and comment.
-
useUTF8ForNames
whether the current entry will use UTF8 for file name and comment.- Parameters:
b- whether the current entry will use UTF8 for file name and comment.
-