Class AbstractUnicodeExtraField
- java.lang.Object
-
- org.apache.commons.compress.archivers.zip.AbstractUnicodeExtraField
-
- All Implemented Interfaces:
ZipExtraField
- Direct Known Subclasses:
UnicodeCommentExtraField,UnicodePathExtraField
public abstract class AbstractUnicodeExtraField extends java.lang.Object implements ZipExtraField
A common base class for Unicode extra information extra fields.
-
-
Field Summary
-
Fields inherited from interface org.apache.commons.compress.archivers.zip.ZipExtraField
EXTRAFIELD_HEADER_SIZE
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]getCentralDirectoryData()The actual data to put into central directory - without Header-ID or length specifier.ZipShortgetCentralDirectoryLength()Length of the extra field in the central directory - without Header-ID or length specifier.byte[]getLocalFileDataData()The actual data to put into local file data - without Header-ID or length specifier.ZipShortgetLocalFileDataLength()Length of the extra field in the local file data - without Header-ID or length specifier.longgetNameCRC32()Gets the CRC32 checksum of the file name or comment as encoded in the central directory of the ZIP file.byte[]getUnicodeName()Gets The UTF-8 encoded name.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)Gets The CRC32 checksum of the file name as encoded in the central directory of the ZIP file to set.voidsetUnicodeName(byte[] unicodeName)Gets the UTF-8 encoded name to set.-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.commons.compress.archivers.zip.ZipExtraField
getHeaderId
-
-
-
-
Method Detail
-
getCentralDirectoryData
public byte[] 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
public ZipShort 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
public byte[] 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
public ZipShort 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
public long getNameCRC32()
Gets the CRC32 checksum of the file name or comment as encoded in the central directory of the ZIP file.- Returns:
- The CRC32 checksum of the file name or comment as encoded in the central directory of the ZIP file.
-
getUnicodeName
public byte[] getUnicodeName()
Gets The UTF-8 encoded name.- Returns:
- The UTF-8 encoded name.
-
parseFromCentralDirectoryData
public void parseFromCentralDirectoryData(byte[] buffer, int offset, int length) throws java.util.zip.ZipExceptionDoesn'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:
java.util.zip.ZipException- on error
-
parseFromLocalFileData
public void parseFromLocalFileData(byte[] buffer, int offset, int length) throws java.util.zip.ZipExceptionDescription 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:
java.util.zip.ZipException- on error
-
setNameCRC32
public void setNameCRC32(long nameCRC32)
Gets The CRC32 checksum of the file name as encoded in the central directory of the ZIP file to set.- Parameters:
nameCRC32- The CRC32 checksum of the file name as encoded in the central directory of the ZIP file to set.
-
setUnicodeName
public void setUnicodeName(byte[] unicodeName)
Gets the UTF-8 encoded name to set.- Parameters:
unicodeName- The UTF-8 encoded name to set.
-
-