Package org.apache.tools.zip
Class Zip64ExtendedInformationExtraField
- java.lang.Object
- 
- org.apache.tools.zip.Zip64ExtendedInformationExtraField
 
- 
- All Implemented Interfaces:
- CentralDirectoryParsingZipExtraField,- ZipExtraField
 
 public class Zip64ExtendedInformationExtraField extends java.lang.Object implements CentralDirectoryParsingZipExtraField Holds size and other extended information for entries that use Zip64 features.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. - Since:
- Ant 1.9.0
 
- 
- 
Constructor SummaryConstructors Constructor 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.
 - 
Method SummaryModifier and Type Method Description byte[]getCentralDirectoryData()The actual data to put into central directory - without Header-ID or length specifier.ZipShortgetCentralDirectoryLength()Length of the extra field in the central directory - without Header-ID or length specifier.ZipEightByteIntegergetCompressedSize()The compressed size stored in this extra field.ZipLonggetDiskStartNumber()The disk start number stored in this extra field.ZipShortgetHeaderId()The Header-ID.byte[]getLocalFileDataData()The actual data to put into local file data - without Header-ID or length specifier.ZipShortgetLocalFileDataLength()Length of the extra field in the local file data - without Header-ID or length specifier.ZipEightByteIntegergetRelativeHeaderOffset()The relative header offset stored in this extra field.ZipEightByteIntegergetSize()The uncompressed size stored in this extra field.voidparseFromCentralDirectoryData(byte[] buffer, int offset, int length)Populate data from this array as if it was in central directory data.voidparseFromLocalFileData(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 extra field with knowledge which fields are expected to be there.voidsetCompressedSize(ZipEightByteInteger compressedSize)The uncompressed size stored in this extra field.voidsetDiskStartNumber(ZipLong ds)The disk start number stored in this extra field.voidsetRelativeHeaderOffset(ZipEightByteInteger rho)The relative header offset stored in this extra field.voidsetSize(ZipEightByteInteger size)The uncompressed size stored in this extra field.
 
- 
- 
- 
Constructor Detail- 
Zip64ExtendedInformationExtraFieldpublic Zip64ExtendedInformationExtraField() This constructor should only be used by the code that reads archives inside of Ant.
 - 
Zip64ExtendedInformationExtraFieldpublic Zip64ExtendedInformationExtraField(ZipEightByteInteger size, ZipEightByteInteger compressedSize) Creates an extra field based on the original and compressed size.- Parameters:
- size- the entry's original size
- compressedSize- the entry's compressed size
- Throws:
- java.lang.IllegalArgumentException- if size or compressedSize is null
 
 - 
Zip64ExtendedInformationExtraFieldpublic 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 size
- compressedSize- the entry's compressed size
- relativeHeaderOffset- ZipEightByteInteger
- diskStart- ZipLong
- Throws:
- java.lang.IllegalArgumentException- if size or compressedSize is null
 
 
- 
 - 
Method Detail- 
getHeaderIdpublic ZipShort getHeaderId() The Header-ID.- Specified by:
- getHeaderIdin interface- ZipExtraField
- Returns:
- the header id
 
 - 
getLocalFileDataLengthpublic ZipShort getLocalFileDataLength() Length of the extra field in the local file data - without Header-ID or length specifier.- Specified by:
- getLocalFileDataLengthin interface- ZipExtraField
- Returns:
- the length of the field in the local file data
 
 - 
getCentralDirectoryLengthpublic ZipShort getCentralDirectoryLength() Length of the extra field in the central directory - without Header-ID or length specifier.- Specified by:
- getCentralDirectoryLengthin interface- ZipExtraField
- Returns:
- the length of the field in the central directory
 
 - 
getLocalFileDataDatapublic byte[] getLocalFileDataData() The actual data to put into local file data - without Header-ID or length specifier.- Specified by:
- getLocalFileDataDatain interface- ZipExtraField
- Returns:
- the data
 
 - 
getCentralDirectoryDatapublic byte[] getCentralDirectoryData() The actual data to put into central directory - without Header-ID or length specifier.- Specified by:
- getCentralDirectoryDatain interface- ZipExtraField
- Returns:
- the data
 
 - 
parseFromLocalFileDatapublic void parseFromLocalFileData(byte[] buffer, int offset, int length) throws java.util.zip.ZipExceptionPopulate data from this array as if it was in local file data.- Specified by:
- parseFromLocalFileDatain interface- ZipExtraField
- Parameters:
- buffer- an array of bytes
- offset- the start offset
- length- the number of bytes in the array from offset
- Throws:
- java.util.zip.ZipException- on error
 
 - 
parseFromCentralDirectoryDatapublic void parseFromCentralDirectoryData(byte[] buffer, int offset, int length) throws java.util.zip.ZipExceptionPopulate data from this array as if it was in central directory data.- Specified by:
- parseFromCentralDirectoryDatain interface- CentralDirectoryParsingZipExtraField
- Parameters:
- buffer- an array of bytes
- offset- the start offset
- length- the number of bytes in the array from offset
- Throws:
- java.util.zip.ZipException- on error
 
 - 
reparseCentralDirectoryDatapublic void reparseCentralDirectoryData(boolean hasUncompressedSize, boolean hasCompressedSize, boolean hasRelativeHeaderOffset, boolean hasDiskStart) throws java.util.zip.ZipExceptionParses the raw bytes read from the central directory extra field with knowledge which fields are expected to be there.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. - Parameters:
- hasUncompressedSize- boolean
- hasCompressedSize- boolean
- hasRelativeHeaderOffset- boolean
- hasDiskStart- boolean
- Throws:
- java.util.zip.ZipException- if expected length of central directory data is incorrect
 
 - 
getSizepublic ZipEightByteInteger getSize() The uncompressed size stored in this extra field.- Returns:
- ZipEightByteInteger
 
 - 
setSizepublic void setSize(ZipEightByteInteger size) The uncompressed size stored in this extra field.- Parameters:
- size- ZipEightByteInteger
 
 - 
getCompressedSizepublic ZipEightByteInteger getCompressedSize() The compressed size stored in this extra field.- Returns:
- ZipEightByteInteger
 
 - 
setCompressedSizepublic void setCompressedSize(ZipEightByteInteger compressedSize) The uncompressed size stored in this extra field.- Parameters:
- compressedSize- ZipEightByteInteger
 
 - 
getRelativeHeaderOffsetpublic ZipEightByteInteger getRelativeHeaderOffset() The relative header offset stored in this extra field.- Returns:
- ZipEightByteInteger
 
 - 
setRelativeHeaderOffsetpublic void setRelativeHeaderOffset(ZipEightByteInteger rho) The relative header offset stored in this extra field.- Parameters:
- rho- ZipEightByteInteger
 
 - 
getDiskStartNumberpublic ZipLong getDiskStartNumber() The disk start number stored in this extra field.- Returns:
- ZipLong
 
 - 
setDiskStartNumberpublic void setDiskStartNumber(ZipLong ds) The disk start number stored in this extra field.- Parameters:
- ds- ZipLong
 
 
- 
 
-