Top Description Fields Constructors Methods
org.apache.tools.zip

public Class Zip64ExtendedInformationExtraField

extends Object
implements CentralDirectoryParsingZipExtraField
Class Inheritance
All Implemented Interfaces
org.apache.tools.zip.CentralDirectoryParsingZipExtraField, org.apache.tools.zip.ZipExtraField
Static Imports
org.apache.tools.zip.ZipConstants.DWORD, .ZipConstants.WORD

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

Field Summary

Modifier and TypeField and Description
private ZipEightByteInteger
private ZipLong
private static final byte[]
pack-priv static final ZipShort
private static final String
private byte[]
private ZipEightByteInteger
private ZipEightByteInteger

Constructor Summary

AccessConstructor and Description
public
Zip64ExtendedInformationExtraField()

This constructor should only be used by the code that reads archives inside of Ant.

public
Zip64ExtendedInformationExtraField(ZipEightByteInteger
the entry's original size
size
,
ZipEightByteInteger
the entry's compressed size
compressedSize
)

Creates an extra field based on the original and compressed size.

public
Zip64ExtendedInformationExtraField(ZipEightByteInteger
the entry's original size
size
,
ZipEightByteInteger
the entry's compressed size
compressedSize
,
ZipEightByteInteger
ZipEightByteInteger
relativeHeaderOffset
,
ZipLong
ZipLong
diskStart
)

Creates an extra field based on all four possible values.

Method Summary

Modifier and TypeMethod and Description
private int
addSizes(byte[] data)

public byte[]
getCentralDirectoryData()

Implements org.apache.tools.zip.ZipExtraField.getCentralDirectoryData.

The actual data to put into central directory - without Header-ID or length specifier.
public ZipShort
getCentralDirectoryLength()

Implements org.apache.tools.zip.ZipExtraField.getCentralDirectoryLength.

Length of the extra field in the central directory - without Header-ID or length specifier.
public ZipEightByteInteger

Returns:

ZipEightByteInteger
getCompressedSize
()

The compressed size stored in this extra field.

public ZipLong

Returns:

ZipLong
getDiskStartNumber
()

The disk start number stored in this extra field.

public ZipShort
public byte[]
getLocalFileDataData()

Implements org.apache.tools.zip.ZipExtraField.getLocalFileDataData.

The actual data to put into local file data - without Header-ID or length specifier.
public ZipShort
getLocalFileDataLength()

Implements org.apache.tools.zip.ZipExtraField.getLocalFileDataLength.

Length of the extra field in the local file data - without Header-ID or length specifier.
public ZipEightByteInteger

Returns:

ZipEightByteInteger
getRelativeHeaderOffset
()

The relative header offset stored in this extra field.

public ZipEightByteInteger

Returns:

ZipEightByteInteger
getSize
()

The uncompressed size stored in this extra field.

public void
parseFromCentralDirectoryData(byte[]
an array of bytes
buffer
,
int
the start offset
offset
,
int
the number of bytes in the array from offset
length
)

Implements org.apache.tools.zip.CentralDirectoryParsingZipExtraField.parseFromCentralDirectoryData.

Populate data from this array as if it was in central directory data.
public void
parseFromLocalFileData(byte[]
an array of bytes
buffer
,
int
the start offset
offset
,
int
the number of bytes in the array from offset
length
)

Implements org.apache.tools.zip.ZipExtraField.parseFromLocalFileData.

Populate data from this array as if it was in local file data.
public void
reparseCentralDirectoryData(boolean
boolean
hasUncompressedSize
,
boolean
boolean
hasCompressedSize
,
boolean
boolean
hasRelativeHeaderOffset
,
boolean
boolean
hasDiskStart
)

Parses the raw bytes read from the central directory extra field with knowledge which fields are expected to be there.

public void
setCompressedSize(ZipEightByteInteger
ZipEightByteInteger
compressedSize
)

The uncompressed size stored in this extra field.

public void
setDiskStartNumber(ZipLong
ZipLong
ds
)

The disk start number stored in this extra field.

public void
setRelativeHeaderOffset(ZipEightByteInteger
ZipEightByteInteger
rho
)

The relative header offset stored in this extra field.

public void
setSize(ZipEightByteInteger
ZipEightByteInteger
size
)

The uncompressed size stored in this extra field.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

compressedSizeback to summary
private ZipEightByteInteger compressedSize
diskStartback to summary
private ZipLong diskStart
EMPTYback to summary
private static final byte[] EMPTY
HEADER_IDback to summary
pack-priv static final ZipShort HEADER_ID
LFH_MUST_HAVE_BOTH_SIZES_MSGback to summary
private static final String LFH_MUST_HAVE_BOTH_SIZES_MSG
rawCentralDirectoryDataback to summary
private byte[] rawCentralDirectoryData

Stored in parseFromCentralDirectoryData so it can be reused when ZipFile calls reparseCentralDirectoryData.

Not used for anything else

relativeHeaderOffsetback to summary
private ZipEightByteInteger relativeHeaderOffset
sizeback to summary
private ZipEightByteInteger size

Constructor Detail

Zip64ExtendedInformationExtraFieldback to summary
public Zip64ExtendedInformationExtraField()

This constructor should only be used by the code that reads archives inside of Ant.

Zip64ExtendedInformationExtraFieldback to summary
public Zip64ExtendedInformationExtraField(ZipEightByteInteger size, ZipEightByteInteger compressedSize)

Creates an extra field based on the original and compressed size.

Parameters
size:ZipEightByteInteger

the entry's original size

compressedSize:ZipEightByteInteger

the entry's compressed size

Exceptions
IllegalArgumentException:
if size or compressedSize is null
Zip64ExtendedInformationExtraFieldback to summary
public Zip64ExtendedInformationExtraField(ZipEightByteInteger size, ZipEightByteInteger compressedSize, ZipEightByteInteger relativeHeaderOffset, ZipLong diskStart)

Creates an extra field based on all four possible values.

Parameters
size:ZipEightByteInteger

the entry's original size

compressedSize:ZipEightByteInteger

the entry's compressed size

relativeHeaderOffset:ZipEightByteInteger

ZipEightByteInteger

diskStart:ZipLong

ZipLong

Exceptions
IllegalArgumentException:
if size or compressedSize is null

Method Detail

addSizesback to summary
private int addSizes(byte[] data)
getCentralDirectoryDataback to summary
public byte[] getCentralDirectoryData()

Implements org.apache.tools.zip.ZipExtraField.getCentralDirectoryData.

Doc from org.apache.tools.zip.ZipExtraField.getCentralDirectoryData.

The actual data to put into central directory - without Header-ID or length specifier.

Returns:byte[]

the data

getCentralDirectoryLengthback to summary
public ZipShort getCentralDirectoryLength()

Implements org.apache.tools.zip.ZipExtraField.getCentralDirectoryLength.

Doc from org.apache.tools.zip.ZipExtraField.getCentralDirectoryLength.

Length of the extra field in the central directory - without Header-ID or length specifier.

Returns:ZipShort

the length of the field in the central directory

getCompressedSizeback to summary
public ZipEightByteInteger getCompressedSize()

The compressed size stored in this extra field.

Returns:ZipEightByteInteger

ZipEightByteInteger

getDiskStartNumberback to summary
public ZipLong getDiskStartNumber()

The disk start number stored in this extra field.

Returns:ZipLong

ZipLong

getHeaderIdback to summary
public ZipShort getHeaderId()

Implements org.apache.tools.zip.ZipExtraField.getHeaderId.

Doc from org.apache.tools.zip.ZipExtraField.getHeaderId.

The Header-ID.

Returns:ZipShort

the header id

getLocalFileDataDataback to summary
public byte[] getLocalFileDataData()

Implements org.apache.tools.zip.ZipExtraField.getLocalFileDataData.

Doc from org.apache.tools.zip.ZipExtraField.getLocalFileDataData.

The actual data to put into local file data - without Header-ID or length specifier.

Returns:byte[]

the data

getLocalFileDataLengthback to summary
public ZipShort getLocalFileDataLength()

Implements org.apache.tools.zip.ZipExtraField.getLocalFileDataLength.

Doc from org.apache.tools.zip.ZipExtraField.getLocalFileDataLength.

Length of the extra field in the local file data - without Header-ID or length specifier.

Returns:ZipShort

the length of the field in the local file data

getRelativeHeaderOffsetback to summary
public ZipEightByteInteger getRelativeHeaderOffset()

The relative header offset stored in this extra field.

Returns:ZipEightByteInteger

ZipEightByteInteger

getSizeback to summary
public ZipEightByteInteger getSize()

The uncompressed size stored in this extra field.

Returns:ZipEightByteInteger

ZipEightByteInteger

parseFromCentralDirectoryDataback to summary
public void parseFromCentralDirectoryData(byte[] buffer, int offset, int length) throws ZipException

Implements org.apache.tools.zip.CentralDirectoryParsingZipExtraField.parseFromCentralDirectoryData.

Doc from org.apache.tools.zip.CentralDirectoryParsingZipExtraField.parseFromCentralDirectoryData.

Populate data from this array as if it was in central directory data.

Parameters
buffer:byte[]

an array of bytes

offset:int

the start offset

length:int

the number of bytes in the array from offset

Exceptions
ZipException:
on error
parseFromLocalFileDataback to summary
public void parseFromLocalFileData(byte[] buffer, int offset, int length) throws ZipException

Implements org.apache.tools.zip.ZipExtraField.parseFromLocalFileData.

Doc from org.apache.tools.zip.ZipExtraField.parseFromLocalFileData.

Populate data from this array as if it was in local file data.

Parameters
buffer:byte[]

an array of bytes

offset:int

the start offset

length:int

the number of bytes in the array from offset

Exceptions
ZipException:
on error
reparseCentralDirectoryDataback to summary
public void reparseCentralDirectoryData(boolean hasUncompressedSize, boolean hasCompressedSize, boolean hasRelativeHeaderOffset, boolean hasDiskStart) throws ZipException

Parses 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

boolean

hasCompressedSize:boolean

boolean

hasRelativeHeaderOffset:boolean

boolean

hasDiskStart:boolean

boolean

Exceptions
ZipException:
if expected length of central directory data is incorrect
setCompressedSizeback to summary
public void setCompressedSize(ZipEightByteInteger compressedSize)

The uncompressed size stored in this extra field.

Parameters
compressedSize:ZipEightByteInteger

ZipEightByteInteger

setDiskStartNumberback to summary
public void setDiskStartNumber(ZipLong ds)

The disk start number stored in this extra field.

Parameters
ds:ZipLong

ZipLong

setRelativeHeaderOffsetback to summary
public void setRelativeHeaderOffset(ZipEightByteInteger rho)

The relative header offset stored in this extra field.

Parameters
rho:ZipEightByteInteger

ZipEightByteInteger

setSizeback to summary
public void setSize(ZipEightByteInteger size)

The uncompressed size stored in this extra field.

Parameters
size:ZipEightByteInteger

ZipEightByteInteger