Class UnrecognizedExtraField
- java.lang.Object
-
- org.apache.commons.compress.archivers.zip.UnrecognizedExtraField
-
- All Implemented Interfaces:
ZipExtraField
public class UnrecognizedExtraField extends java.lang.Object implements ZipExtraField
Simple placeholder for all those extra fields we don't want to deal with.Assumes local file data and central directory entries are identical - unless told the opposite.
-
-
Field Summary
-
Fields inherited from interface org.apache.commons.compress.archivers.zip.ZipExtraField
EXTRAFIELD_HEADER_SIZE
-
-
Constructor Summary
Constructors Constructor Description UnrecognizedExtraField()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]getCentralDirectoryData()Gets the central data.ZipShortgetCentralDirectoryLength()Gets the central data length.ZipShortgetHeaderId()Gets the header id.byte[]getLocalFileDataData()Gets the local data.ZipShortgetLocalFileDataLength()Gets the length of the local data.voidparseFromCentralDirectoryData(byte[] data, int offset, int length)Populate data from this array as if it was in central directory data.voidparseFromLocalFileData(byte[] data, int offset, int length)Populate data from this array as if it was in local file data.voidsetCentralDirectoryData(byte[] data)Sets the extra field data in central directory.voidsetHeaderId(ZipShort headerId)Sets the header id.voidsetLocalFileDataData(byte[] data)Sets the extra field data in the local file data - without Header-ID or length specifier.
-
-
-
Method Detail
-
getCentralDirectoryData
public byte[] getCentralDirectoryData()
Gets the central data.- Specified by:
getCentralDirectoryDatain interfaceZipExtraField- Returns:
- the central data if present, else return the local file data
-
getCentralDirectoryLength
public ZipShort getCentralDirectoryLength()
Gets the central data length. If there is no central data, get the local file data length.- Specified by:
getCentralDirectoryLengthin interfaceZipExtraField- Returns:
- the central data length
-
getHeaderId
public ZipShort getHeaderId()
Gets the header id.- Specified by:
getHeaderIdin interfaceZipExtraField- Returns:
- the header id
-
getLocalFileDataData
public byte[] getLocalFileDataData()
Gets the local data.- Specified by:
getLocalFileDataDatain interfaceZipExtraField- Returns:
- the local data
-
getLocalFileDataLength
public ZipShort getLocalFileDataLength()
Gets the length of the local data.- Specified by:
getLocalFileDataLengthin interfaceZipExtraField- Returns:
- the length of the local data
-
parseFromCentralDirectoryData
public void parseFromCentralDirectoryData(byte[] data, int offset, int length)Description copied from interface:ZipExtraFieldPopulate data from this array as if it was in central directory data.- Specified by:
parseFromCentralDirectoryDatain interfaceZipExtraField- Parameters:
data- the array of bytes.offset- the source location in the data array.length- the number of bytes to use in the data array.- See Also:
ZipExtraField.parseFromCentralDirectoryData(byte[], int, int)
-
parseFromLocalFileData
public void parseFromLocalFileData(byte[] data, int offset, int length)Description copied from interface:ZipExtraFieldPopulate data from this array as if it was in local file data.- Specified by:
parseFromLocalFileDatain interfaceZipExtraField- Parameters:
data- the array of bytes.offset- the source location in the data array.length- the number of bytes to use in the data array.- See Also:
ZipExtraField.parseFromLocalFileData(byte[], int, int)
-
setCentralDirectoryData
public void setCentralDirectoryData(byte[] data)
Sets the extra field data in central directory.- Parameters:
data- the data to use
-
setHeaderId
public void setHeaderId(ZipShort headerId)
Sets the header id.- Parameters:
headerId- the header id to use
-
setLocalFileDataData
public void setLocalFileDataData(byte[] data)
Sets the extra field data in the local file data - without Header-ID or length specifier.- Parameters:
data- the field data to use
-
-