-
- All Implemented Interfaces:
-
org.readium.r2.shared.util.zip.compress.archivers.zip.ZipExtraField
public class Zip64ExtendedInformationExtraField implements ZipExtraField
Holds size and other extended information for entries that use Zip64 features.
Currently Commons Compress doesn't support encrypting the central directory so the note in APPNOTE.TXT 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.
-
-
Field Summary
Fields Modifier and Type Field Description private ZipEightByteIntegersizeprivate ZipEightByteIntegercompressedSizeprivate ZipEightByteIntegerrelativeHeaderOffset
-
Constructor Summary
Constructors Constructor Description Zip64ExtendedInformationExtraField()This constructor should only be used by the code that readsarchives inside of Commons Compress. 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.
-
Method Summary
Modifier and Type Method Description ZipEightByteIntegergetSize()The uncompressed size stored in this extra field. voidsetSize(ZipEightByteInteger size)The uncompressed size stored in this extra field. ZipEightByteIntegergetCompressedSize()The compressed size stored in this extra field. voidsetCompressedSize(ZipEightByteInteger compressedSize)The uncompressed size stored in this extra field. ZipEightByteIntegergetRelativeHeaderOffset()The relative header offset stored in this extra field. voidsetRelativeHeaderOffset(ZipEightByteInteger rho)The relative header offset stored in this extra field. Array<byte>getCentralDirectoryData()The actual data to put into central directory - without Header-ID orlength specifier. ZipShortgetCentralDirectoryLength()Length of the extra field in the central directory - withoutHeader-ID or length specifier. ZipLonggetDiskStartNumber()The disk start number stored in this extra field. ZipShortgetHeaderId()The Header-ID. Array<byte>getLocalFileDataData()The actual data to put into local file data - without Header-IDor length specifier. ZipShortgetLocalFileDataLength()Length of the extra field in the local file data - withoutHeader-ID or length specifier. voidparseFromCentralDirectoryData(Array<byte> buffer, int offset, int length)Populate data from this array as if it was in central directory data. voidparseFromLocalFileData(Array<byte> buffer, int offset, int length)Populate data from this array as if it was in local file data. voidreparseCentralDirectoryData(boolean hasUncompressedSize, boolean hasCompressedSize, boolean hasRelativeHeaderOffset, boolean hasDiskStart)Parses the raw bytes read from the central directory extrafield with knowledge which fields are expected to be there. voidsetDiskStartNumber(ZipLong ds)The disk start number stored in this extra field. -
-
Constructor Detail
-
Zip64ExtendedInformationExtraField
Zip64ExtendedInformationExtraField()
This constructor should only be used by the code that readsarchives inside of Commons Compress.
-
Zip64ExtendedInformationExtraField
Zip64ExtendedInformationExtraField(ZipEightByteInteger size, ZipEightByteInteger compressedSize)
Creates an extra field based on the original and compressed size.- Parameters:
size- the entry's original sizecompressedSize- the entry's compressed size
-
Zip64ExtendedInformationExtraField
Zip64ExtendedInformationExtraField(ZipEightByteInteger size, ZipEightByteInteger compressedSize, ZipEightByteInteger relativeHeaderOffset, ZipLong diskStart)
Creates an extra field based on all four possible values.- Parameters:
size- the entry's original sizecompressedSize- the entry's compressed sizerelativeHeaderOffset- the entry's offsetdiskStart- the disk start
-
-
Method Detail
-
getSize
ZipEightByteInteger getSize()
The uncompressed size stored in this extra field.
-
setSize
void setSize(ZipEightByteInteger size)
The uncompressed size stored in this extra field.
- Parameters:
size- The uncompressed size stored in this extra field.
-
getCompressedSize
ZipEightByteInteger getCompressedSize()
The compressed size stored in this extra field.
-
setCompressedSize
void setCompressedSize(ZipEightByteInteger compressedSize)
The uncompressed size stored in this extra field.
- Parameters:
compressedSize- The uncompressed size stored in this extra field.
-
getRelativeHeaderOffset
ZipEightByteInteger getRelativeHeaderOffset()
The relative header offset stored in this extra field.
-
setRelativeHeaderOffset
void setRelativeHeaderOffset(ZipEightByteInteger rho)
The relative header offset stored in this extra field.
- Parameters:
rho- The relative header offset stored in this extra field.
-
getCentralDirectoryData
Array<byte> getCentralDirectoryData()
The actual data to put into central directory - without Header-ID orlength specifier.
-
getCentralDirectoryLength
ZipShort getCentralDirectoryLength()
Length of the extra field in the central directory - withoutHeader-ID or length specifier.
-
getDiskStartNumber
ZipLong getDiskStartNumber()
The disk start number stored in this extra field.
-
getHeaderId
ZipShort getHeaderId()
The Header-ID.
-
getLocalFileDataData
Array<byte> getLocalFileDataData()
The actual data to put into local file data - without Header-IDor length specifier.
-
getLocalFileDataLength
ZipShort getLocalFileDataLength()
Length of the extra field in the local file data - withoutHeader-ID or length specifier.
-
parseFromCentralDirectoryData
void parseFromCentralDirectoryData(Array<byte> buffer, int offset, int length)
Populate data from this array as if it was in central directory data.
- Parameters:
buffer- the buffer to read data fromoffset- offset into buffer to read datalength- the length of data
-
parseFromLocalFileData
void parseFromLocalFileData(Array<byte> buffer, int offset, int length)
Populate data from this array as if it was in local file data.
- Parameters:
buffer- the buffer to read data fromoffset- offset into buffer to read datalength- the length of data
-
reparseCentralDirectoryData
void reparseCentralDirectoryData(boolean hasUncompressedSize, boolean hasCompressedSize, boolean hasRelativeHeaderOffset, boolean hasDiskStart)
Parses the raw bytes read from the central directory extrafield with knowledge which fields are expected to be there.
All four fields inside the zip64 extended information extrafield are optional and must only be present if their correspondingentry inside the central directory contains the correct magicvalue.
- Parameters:
hasUncompressedSize- flag to read from central directoryhasCompressedSize- flag to read from central directoryhasRelativeHeaderOffset- flag to read from central directoryhasDiskStart- flag to read from central directory
-
setDiskStartNumber
void setDiskStartNumber(ZipLong ds)
The disk start number stored in this extra field.
- Parameters:
ds- The disk start number stored in this extra field.
-
-
-
-