Class AbstractUnicodeExtraField
java.lang.Object
org.apache.commons.compress.archivers.zip.AbstractUnicodeExtraField
- All Implemented Interfaces:
ZipExtraField
- Direct Known Subclasses:
UnicodeCommentExtraField,UnicodePathExtraField
A common base class for Unicode extra information extra fields.
- This class is not thread-safe
-
Field Summary
Fields inherited from interface org.apache.commons.compress.archivers.zip.ZipExtraField
EXTRAFIELD_HEADER_SIZE -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedprotectedAbstractUnicodeExtraField(String text, byte[] bytes) Assemble as unicode extension from the name/comment and encoding of the original ZIP entry.protectedAbstractUnicodeExtraField(String text, byte[] bytes, int off, int len) Assemble as unicode extension from the name/comment and encoding of the original ZIP entry. -
Method Summary
Modifier and TypeMethodDescriptionbyte[]The actual data to put into central directory - without Header-ID or length specifier.Length of the extra field in the central directory - without Header-ID or length specifier.byte[]The actual data to put into local file data - without Header-ID or length specifier.Length of the extra field in the local file data - without Header-ID or length specifier.longbyte[]voidparseFromCentralDirectoryData(byte[] buffer, int offset, int length) Doesn't do anything special since this class always uses the same data in central directory and local file data.voidparseFromLocalFileData(byte[] buffer, int offset, int length) Populate data from this array as if it was in local file data.voidsetNameCRC32(long nameCRC32) voidsetUnicodeName(byte[] unicodeName) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.commons.compress.archivers.zip.ZipExtraField
getHeaderId
-
Constructor Details
-
AbstractUnicodeExtraField
protected AbstractUnicodeExtraField() -
AbstractUnicodeExtraField
Assemble as unicode extension from the name/comment and encoding of the original ZIP entry.- Parameters:
text- The file name or comment.bytes- The encoded of the file name or comment in the ZIP file.
-
AbstractUnicodeExtraField
Assemble as unicode extension from the name/comment and encoding of the original ZIP entry.- Parameters:
text- The file name or comment.bytes- The encoded of the file name or comment in the ZIP file.off- The offset of the encoded file name or comment inbytes.len- The length of the encoded file name or comment inbytes.
-
-
Method Details
-
getCentralDirectoryData
Description copied from interface:ZipExtraFieldThe actual data to put into central directory - without Header-ID or length specifier.- Specified by:
getCentralDirectoryDatain interfaceZipExtraField- Returns:
- the data
-
getCentralDirectoryLength
Description copied from interface:ZipExtraFieldLength of the extra field in the central directory - without Header-ID or length specifier.- Specified by:
getCentralDirectoryLengthin interfaceZipExtraField- Returns:
- the length of the field in the central directory
-
getLocalFileDataData
Description copied from interface:ZipExtraFieldThe actual data to put into local file data - without Header-ID or length specifier.- Specified by:
getLocalFileDataDatain interfaceZipExtraField- Returns:
- the data
-
getLocalFileDataLength
Description copied from interface:ZipExtraFieldLength of the extra field in the local file data - without Header-ID or length specifier.- Specified by:
getLocalFileDataLengthin interfaceZipExtraField- Returns:
- the length of the field in the local file data
-
getNameCRC32
- Returns:
- The CRC32 checksum of the file name or comment as encoded in the central directory of the ZIP file.
-
getUnicodeName
- Returns:
- The UTF-8 encoded name.
-
parseFromCentralDirectoryData
public void parseFromCentralDirectoryData(byte[] buffer, int offset, int length) throws ZipException Doesn't do anything special since this class always uses the same data in central directory and local file data.- Specified by:
parseFromCentralDirectoryDatain interfaceZipExtraField- Parameters:
buffer- the buffer to read data fromoffset- offset into buffer to read datalength- the length of data- Throws:
ZipException- on error
-
parseFromLocalFileData
Description copied from interface:ZipExtraFieldPopulate data from this array as if it was in local file data.- Specified by:
parseFromLocalFileDatain interfaceZipExtraField- Parameters:
buffer- the buffer to read data fromoffset- offset into buffer to read datalength- the length of data- Throws:
ZipException- on error
-
setNameCRC32
- Parameters:
nameCRC32- The CRC32 checksum of the file name as encoded in the central directory of the ZIP file to set.
-
setUnicodeName
- Parameters:
unicodeName- The UTF-8 encoded name to set.
-