public class Zip64ExtendedInformationExtraField extends java.lang.Object implements CentralDirectoryParsingZipExtraField
See PKWARE's APPNOTE.TXT, section 4.5.3.
Currently Ant doesn't support encrypting the central directory so the note about masking doesn't apply.
The implementation relies on data being read from the local file header and assumes that both size values are always present.
Constructor and Description |
---|
Zip64ExtendedInformationExtraField()
This constructor should only be used by the code that reads
archives inside of Ant.
|
Zip64ExtendedInformationExtraField(ZipEightByteInteger size,
ZipEightByteInteger compressedSize)
Creates an extra field based on the original and compressed size.
|
Zip64ExtendedInformationExtraField(ZipEightByteInteger size,
ZipEightByteInteger compressedSize,
ZipEightByteInteger relativeHeaderOffset,
ZipLong diskStart)
Creates an extra field based on all four possible values.
|
Modifier and Type | Method and Description |
---|---|
byte[] |
getCentralDirectoryData()
The actual data to put into central directory - without Header-ID or
length specifier.
|
ZipShort |
getCentralDirectoryLength()
Length of the extra field in the central directory - without
Header-ID or length specifier.
|
ZipEightByteInteger |
getCompressedSize()
The compressed size stored in this extra field.
|
ZipLong |
getDiskStartNumber()
The disk start number stored in this extra field.
|
ZipShort |
getHeaderId()
The Header-ID.
|
byte[] |
getLocalFileDataData()
The actual data to put into local file data - without Header-ID
or length specifier.
|
ZipShort |
getLocalFileDataLength()
Length of the extra field in the local file data - without
Header-ID or length specifier.
|
ZipEightByteInteger |
getRelativeHeaderOffset()
The relative header offset stored in this extra field.
|
ZipEightByteInteger |
getSize()
The uncompressed size stored in this extra field.
|
void |
parseFromCentralDirectoryData(byte[] buffer,
int offset,
int length)
Populate data from this array as if it was in central directory data.
|
void |
parseFromLocalFileData(byte[] buffer,
int offset,
int length)
Populate data from this array as if it was in local file data.
|
void |
reparseCentralDirectoryData(boolean hasUncompressedSize,
boolean hasCompressedSize,
boolean hasRelativeHeaderOffset,
boolean hasDiskStart)
Parses the raw bytes read from the central directory extra
field with knowledge which fields are expected to be there.
|
void |
setCompressedSize(ZipEightByteInteger compressedSize)
The uncompressed size stored in this extra field.
|
void |
setDiskStartNumber(ZipLong ds)
The disk start number stored in this extra field.
|
void |
setRelativeHeaderOffset(ZipEightByteInteger rho)
The relative header offset stored in this extra field.
|
void |
setSize(ZipEightByteInteger size)
The uncompressed size stored in this extra field.
|
public Zip64ExtendedInformationExtraField()
public Zip64ExtendedInformationExtraField(ZipEightByteInteger size, ZipEightByteInteger compressedSize)
size
- the entry's original sizecompressedSize
- the entry's compressed sizejava.lang.IllegalArgumentException
- if size or compressedSize is nullpublic Zip64ExtendedInformationExtraField(ZipEightByteInteger size, ZipEightByteInteger compressedSize, ZipEightByteInteger relativeHeaderOffset, ZipLong diskStart)
size
- the entry's original sizecompressedSize
- the entry's compressed sizerelativeHeaderOffset
- ZipEightByteIntegerdiskStart
- ZipLongjava.lang.IllegalArgumentException
- if size or compressedSize is nullpublic ZipShort getHeaderId()
getHeaderId
in interface ZipExtraField
public ZipShort getLocalFileDataLength()
getLocalFileDataLength
in interface ZipExtraField
public ZipShort getCentralDirectoryLength()
getCentralDirectoryLength
in interface ZipExtraField
public byte[] getLocalFileDataData()
getLocalFileDataData
in interface ZipExtraField
public byte[] getCentralDirectoryData()
getCentralDirectoryData
in interface ZipExtraField
public void parseFromLocalFileData(byte[] buffer, int offset, int length) throws java.util.zip.ZipException
parseFromLocalFileData
in interface ZipExtraField
buffer
- an array of bytesoffset
- the start offsetlength
- the number of bytes in the array from offsetjava.util.zip.ZipException
- on errorpublic void parseFromCentralDirectoryData(byte[] buffer, int offset, int length) throws java.util.zip.ZipException
parseFromCentralDirectoryData
in interface CentralDirectoryParsingZipExtraField
buffer
- an array of bytesoffset
- the start offsetlength
- the number of bytes in the array from offsetjava.util.zip.ZipException
- on errorpublic void reparseCentralDirectoryData(boolean hasUncompressedSize, boolean hasCompressedSize, boolean hasRelativeHeaderOffset, boolean hasDiskStart) throws java.util.zip.ZipException
All four fields inside the zip64 extended information extra field are optional and must only be present if their corresponding entry inside the central directory contains the correct magic value.
hasUncompressedSize
- booleanhasCompressedSize
- booleanhasRelativeHeaderOffset
- booleanhasDiskStart
- booleanjava.util.zip.ZipException
- if expected length of central directory data is incorrectpublic ZipEightByteInteger getSize()
public void setSize(ZipEightByteInteger size)
size
- ZipEightByteIntegerpublic ZipEightByteInteger getCompressedSize()
public void setCompressedSize(ZipEightByteInteger compressedSize)
compressedSize
- ZipEightByteIntegerpublic ZipEightByteInteger getRelativeHeaderOffset()
public void setRelativeHeaderOffset(ZipEightByteInteger rho)
rho
- ZipEightByteIntegerpublic ZipLong getDiskStartNumber()
public void setDiskStartNumber(ZipLong ds)
ds
- ZipLong