Package org.apache.tools.zip
Class GeneralPurposeBit
java.lang.Object
org.apache.tools.zip.GeneralPurposeBit
- All Implemented Interfaces:
Cloneable
Parser/encoder for the "general purpose bit" field in ZIP's local
file and central directory headers.
- Since:
- Ant 1.9.0
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Indicates that filenames are written in utf-8. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionclone()
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
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 informationvoid
useEncryption
(boolean b) whether the current entry will be encryptedboolean
whether the current entry uses the data descriptor to store CRC and size informationboolean
whether the current entry is encryptedboolean
whether the current entry is encrypted using strong encryptionvoid
useStrongEncryption
(boolean b) whether the current entry will be encrypted using strong encryptionboolean
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.
-
Field Details
-
UFT8_NAMES_FLAG
public static final int UFT8_NAMES_FLAGIndicates that filenames are written in utf-8.The only reason this is public is that
ZipOutputStream.EFS_FLAG
was public in several versions of Apache Ant and we needed a substitute for it.- See Also:
-
-
Constructor Details
-
GeneralPurposeBit
public GeneralPurposeBit()
-
-
Method Details
-
usesUTF8ForNames
public boolean usesUTF8ForNames()whether the current entry uses UTF8 for file name and comment.- Returns:
- boolean
-
useUTF8ForNames
public void useUTF8ForNames(boolean b) whether the current entry will use UTF8 for file name and comment.- Parameters:
b
- boolean
-
usesDataDescriptor
public boolean usesDataDescriptor()whether the current entry uses the data descriptor to store CRC and size information- Returns:
- boolean
-
useDataDescriptor
public void useDataDescriptor(boolean b) whether the current entry will use the data descriptor to store CRC and size information- Parameters:
b
- boolean
-
usesEncryption
public boolean usesEncryption()whether the current entry is encrypted- Returns:
- boolean
-
useEncryption
public void useEncryption(boolean b) whether the current entry will be encrypted- Parameters:
b
- boolean
-
usesStrongEncryption
public boolean usesStrongEncryption()whether the current entry is encrypted using strong encryption- Returns:
- boolean
-
useStrongEncryption
public void useStrongEncryption(boolean b) whether the current entry will be encrypted using strong encryption- Parameters:
b
- boolean
-
encode
public byte[] encode()Encodes the set bits in a form suitable for ZIP archives.- Returns:
- byte[]
-
encode
public void encode(byte[] buf, int offset) 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
-
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:
- GeneralPurposeBit
-
hashCode
public int hashCode() -
equals
-
clone
-