public class Zip64ExtendedInformationExtraField extends java.lang.Object implements ZipExtraField
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.
EXTRAFIELD_HEADER_SIZE
Constructor and Description |
---|
Zip64ExtendedInformationExtraField()
This constructor should only be used by the code that reads
archives 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.
|
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
- the entry's offsetdiskStart
- the disk startjava.lang.IllegalArgumentException
- if size or compressedSize is nullpublic ZipShort getHeaderId()
ZipExtraField
getHeaderId
in interface ZipExtraField
public ZipShort getLocalFileDataLength()
ZipExtraField
getLocalFileDataLength
in interface ZipExtraField
public ZipShort getCentralDirectoryLength()
ZipExtraField
getCentralDirectoryLength
in interface ZipExtraField
public byte[] getLocalFileDataData()
ZipExtraField
getLocalFileDataData
in interface ZipExtraField
public byte[] getCentralDirectoryData()
ZipExtraField
getCentralDirectoryData
in interface ZipExtraField
public void parseFromLocalFileData(byte[] buffer, int offset, int length) throws java.util.zip.ZipException
ZipExtraField
parseFromLocalFileData
in interface ZipExtraField
buffer
- the buffer to read data fromoffset
- offset into buffer to read datalength
- the length of datajava.util.zip.ZipException
- on errorpublic void parseFromCentralDirectoryData(byte[] buffer, int offset, int length) throws java.util.zip.ZipException
ZipExtraField
parseFromCentralDirectoryData
in interface ZipExtraField
buffer
- the buffer to read data fromoffset
- offset into buffer to read datalength
- the length of datajava.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
- flag to read from central directoryhasCompressedSize
- flag to read from central directoryhasRelativeHeaderOffset
- flag to read from central directoryhasDiskStart
- flag to read from central directoryjava.util.zip.ZipException
- on errorpublic ZipEightByteInteger getSize()
public void setSize(ZipEightByteInteger size)
size
- The uncompressed size stored in this extra field.public ZipEightByteInteger getCompressedSize()
public void setCompressedSize(ZipEightByteInteger compressedSize)
compressedSize
- The uncompressed size stored in this extra field.public ZipEightByteInteger getRelativeHeaderOffset()
public void setRelativeHeaderOffset(ZipEightByteInteger rho)
rho
- The relative header offset stored in this extra field.public ZipLong getDiskStartNumber()
public void setDiskStartNumber(ZipLong ds)
ds
- The disk start number stored in this extra field.Copyright © 2010 - 2020 Adobe. All Rights Reserved