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

public Interface ExtraFieldParsingBehavior

extends UnparseableExtraFieldBehavior
Known Direct Implementers
org.apache.commons.compress.archivers.zip.ZipArchiveEntry.ExtraFieldParsingMode
Imports
java.util.zip.ZipException

Controls details of parsing ZIP extra fields.
Since
1.19

Method Summary

Modifier and TypeMethod and Description
public ZipExtraField

Returns:

an instance of ZipExtraField, must not be null
createExtraField
(ZipShort
the id for the extra field
headerId
)

Creates an instance of ZipExtraField for the given id.

A good default implementation would be ExtraFieldUtils#createExtraField.

public ZipExtraField

Returns:

the filled field. Usually this is the same as field but it could be a replacement extra field as well. Must not be null.
fill
(ZipExtraField
the extra field instance to fill
field
,
byte[]
the array of extra field data
data
,
int
offset into data where this field's data starts
off
,
int
the length of this field's data
len
,
boolean
whether the extra field data stems from the local file header. If this is false then the data is part if the central directory header extra data.
local
)

Fills in the extra field data for a single extra field.

Inherited from org.apache.commons.compress.archivers.zip.UnparseableExtraFieldBehavior:
onUnparseableExtraField

Method Detail

createExtraFieldback to summary
public ZipExtraField createExtraField(ZipShort headerId) throws ZipException, InstantiationException, IllegalAccessException

Creates an instance of ZipExtraField for the given id.

A good default implementation would be ExtraFieldUtils#createExtraField.

Parameters
headerId:ZipShort

the id for the extra field

Returns:ZipExtraField

an instance of ZipExtraField, must not be null

Exceptions
ZipException:
if an error occurs
InstantiationException:
if unable to instantiate the class, not thrown by Commons Compress.
IllegalAccessException:
if not allowed to instantiate the class, not thrown by Commons Compress.
fillback to summary
public ZipExtraField fill(ZipExtraField field, byte[] data, int off, int len, boolean local) throws ZipException

Fills in the extra field data for a single extra field.

A good default implementation would be ExtraFieldUtils#fillExtraField.

Parameters
field:ZipExtraField

the extra field instance to fill

data:byte[]

the array of extra field data

off:int

offset into data where this field's data starts

len:int

the length of this field's data

local:boolean

whether the extra field data stems from the local file header. If this is false then the data is part if the central directory header extra data.

Returns:ZipExtraField

the filled field. Usually this is the same as field but it could be a replacement extra field as well. Must not be null.

Exceptions
ZipException:
if an error occurs