Top Description Fields Methods
org.apache.commons.compress.archivers.zip

public Interface ZipExtraField

Known Direct Implementers
org.apache.commons.compress.archivers.zip.AbstractUnicodeExtraField, org.apache.commons.compress.archivers.zip.AsiExtraField, org.apache.commons.compress.archivers.zip.JarMarker, org.apache.commons.compress.archivers.zip.PKWareExtraHeader, org.apache.commons.compress.archivers.zip.ResourceAlignmentExtraField, org.apache.commons.compress.archivers.zip.UnparseableExtraFieldData, org.apache.commons.compress.archivers.zip.UnrecognizedExtraField, org.apache.commons.compress.archivers.zip.X000A_NTFS, org.apache.commons.compress.archivers.zip.X5455_ExtendedTimestamp, org.apache.commons.compress.archivers.zip.X7875_NewUnix, org.apache.commons.compress.archivers.zip.Zip64ExtendedInformationExtraField
Imports
java.util.zip.ZipException

General format of extra field data.

Extra fields usually appear twice per file, once in the local file data and once in the central directory. Usually they are the same, but they don't have to be. java.util.zip.ZipOutputStream will only use the local file data in both places.

Field Summary

Modifier and TypeField and Description
public static final int
EXTRAFIELD_HEADER_SIZE

Size of an extra field header (id + length).

Method Summary

Modifier and TypeMethod and Description
public byte[]

Returns:

the data
getCentralDirectoryData
()

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

public ZipShort

Returns:

the length of the field in the central directory
getCentralDirectoryLength
()

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

public ZipShort

Returns:

The HeaderId value
getHeaderId
()

The Header-ID.

public byte[]

Returns:

the data
getLocalFileDataData
()

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

public ZipShort

Returns:

the length of the field in the local file data
getLocalFileDataLength
()

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

public void
parseFromCentralDirectoryData(byte[]
the buffer to read data from
buffer
,
int
offset into buffer to read data
offset
,
int
the length of data
length
)

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

public void
parseFromLocalFileData(byte[]
the buffer to read data from
buffer
,
int
offset into buffer to read data
offset
,
int
the length of data
length
)

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

Field Detail

EXTRAFIELD_HEADER_SIZEback to summary
public static final int EXTRAFIELD_HEADER_SIZE

Size of an extra field header (id + length).

Since
1.14

Method Detail

getCentralDirectoryDataback to summary
public byte[] 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()

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

getHeaderIdback to summary
public ZipShort getHeaderId()

The Header-ID.

Returns:ZipShort

The HeaderId value

getLocalFileDataDataback to summary
public byte[] 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()

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

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

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

Parameters
buffer:byte[]

the buffer to read data from

offset:int

offset into buffer to read data

length:int

the length of data

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

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

Parameters
buffer:byte[]

the buffer to read data from

offset:int

offset into buffer to read data

length:int

the length of data

Exceptions
ZipException:
on error