Package org.zeroturnaround.zip.extra
Class UnrecognizedExtraField
- java.lang.Object
-
- org.zeroturnaround.zip.extra.UnrecognizedExtraField
-
- All Implemented Interfaces:
ZipExtraField
public class UnrecognizedExtraField extends java.lang.Object implements ZipExtraField
This is a class that has been made significantly smaller (deleted a bunch of methods) and originally is from the Apache Ant Project (http://ant.apache.org), org.apache.tools.zip package. All license and other documentation is intact. 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 Modifier and Type Field Description private byte[]
centralData
Extra field data in central directory - without Header-ID or length specifier.private ZipShort
headerId
The Header-ID.private byte[]
localData
Extra field data in local file data - without Header-ID or length specifier.
-
Constructor Summary
Constructors Constructor Description UnrecognizedExtraField()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static byte[]
copy(byte[] from)
Create a copy of the given array - or return null if the argument is null.byte[]
getCentralDirectoryData()
Get the central data.ZipShort
getCentralDirectoryLength()
Get the central data length.ZipShort
getHeaderId()
Get the header id.byte[]
getLocalFileDataData()
Get the local data.ZipShort
getLocalFileDataLength()
Get the length of the local data.void
parseFromCentralDirectoryData(byte[] data, int offset, int length)
void
parseFromLocalFileData(byte[] data, int offset, int length)
Populate data from this array as if it was in local file data.void
setCentralDirectoryData(byte[] data)
Set the extra field data in central directory.void
setHeaderId(ZipShort headerId)
Set the header id.void
setLocalFileDataData(byte[] data)
Set the extra field data in the local file data - without Header-ID or length specifier.
-
-
-
Field Detail
-
headerId
private ZipShort headerId
The Header-ID.- Since:
- 1.1
-
localData
private byte[] localData
Extra field data in local file data - without Header-ID or length specifier.- Since:
- 1.1
-
centralData
private byte[] centralData
Extra field data in central directory - without Header-ID or length specifier.- Since:
- 1.1
-
-
Method Detail
-
setHeaderId
public void setHeaderId(ZipShort headerId)
Set the header id.- Parameters:
headerId
- the header id to use
-
getHeaderId
public ZipShort getHeaderId()
Get the header id.- Specified by:
getHeaderId
in interfaceZipExtraField
- Returns:
- the header id
-
setLocalFileDataData
public void setLocalFileDataData(byte[] data)
Set the extra field data in the local file data - without Header-ID or length specifier.- Parameters:
data
- the field data to use
-
getLocalFileDataLength
public ZipShort getLocalFileDataLength()
Get the length of the local data.- Specified by:
getLocalFileDataLength
in interfaceZipExtraField
- Returns:
- the length of the local data
-
getLocalFileDataData
public byte[] getLocalFileDataData()
Get the local data.- Specified by:
getLocalFileDataData
in interfaceZipExtraField
- Returns:
- the local data
-
setCentralDirectoryData
public void setCentralDirectoryData(byte[] data)
Set the extra field data in central directory.- Parameters:
data
- the data to use
-
getCentralDirectoryLength
public ZipShort getCentralDirectoryLength()
Get the central data length. If there is no central data, get the local file data length.- Specified by:
getCentralDirectoryLength
in interfaceZipExtraField
- Returns:
- the central data length
-
getCentralDirectoryData
public byte[] getCentralDirectoryData()
Get the central data.- Specified by:
getCentralDirectoryData
in interfaceZipExtraField
- Returns:
- the central data if present, else return the local file data
-
parseFromLocalFileData
public void parseFromLocalFileData(byte[] data, int offset, int length)
Description copied from interface:ZipExtraField
Populate data from this array as if it was in local file data.- Specified by:
parseFromLocalFileData
in 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)
-
parseFromCentralDirectoryData
public void parseFromCentralDirectoryData(byte[] data, int offset, int length)
- 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.
-
copy
private static byte[] copy(byte[] from)
Create a copy of the given array - or return null if the argument is null.
-
-