-
public class ExtraFieldUtilsZipExtraField related methods
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final classExtraFieldUtils.UnparseableExtraField"enum" for the possible actions to take if the extra fieldcannot be parsed.
This class has been created long before Java 5 and wouldhave been a real enum ever since.
-
Method Summary
Modifier and Type Method Description static ZipExtraFieldcreateExtraField(ZipShort headerId)Create an instance of the appropriate ExtraField, falls back to UnrecognizedExtraField. static ZipExtraFieldcreateExtraFieldNoDefault(ZipShort headerId)Create an instance of the appropriate ExtraField. static ZipExtraFieldfillExtraField(ZipExtraField ze, Array<byte> data, int off, int len, boolean local)Fills in the extra field data into the given instance. static Array<byte>mergeCentralDirectoryData(Array<ZipExtraField> data)Merges the central directory fields of the given ZipExtraFields. static Array<byte>mergeLocalFileDataData(Array<ZipExtraField> data)Merges the local file data fields of the given ZipExtraFields. static Array<ZipExtraField>parse(Array<byte> data)Split the array into ExtraFields and populate them with thegiven data as local file data, throwing an exception if thedata cannot be parsed. static Array<ZipExtraField>parse(Array<byte> data, boolean local)Split the array into ExtraFields and populate them with thegiven data, throwing an exception if the data cannot be parsed. static Array<ZipExtraField>parse(Array<byte> data, boolean local, ExtraFieldParsingBehavior parsingBehavior)Split the array into ExtraFields and populate them with thegiven data. static Array<ZipExtraField>parse(Array<byte> data, boolean local, ExtraFieldUtils.UnparseableExtraField onUnparseableData)Split the array into ExtraFields and populate them with thegiven data. static voidregister(Class<out Object> c)Register a ZipExtraField implementation. -
-
Method Detail
-
createExtraField
static ZipExtraField createExtraField(ZipShort headerId)
Create an instance of the appropriate ExtraField, falls back to UnrecognizedExtraField.
- Parameters:
headerId- the header identifier
-
createExtraFieldNoDefault
static ZipExtraField createExtraFieldNoDefault(ZipShort headerId)
Create an instance of the appropriate ExtraField.
- Parameters:
headerId- the header identifier
-
fillExtraField
static ZipExtraField fillExtraField(ZipExtraField ze, Array<byte> data, int off, int len, boolean local)
Fills in the extra field data into the given instance.
Calls parseFromCentralDirectoryData or parseFromLocalFileData internally and wraps any ArrayIndexOutOfBoundsException thrown into a ZipException.
- Parameters:
ze- the extra field instance to filldata- the array of extra field dataoff- offset into data where this field's data startslen- the length of this field's datalocal- whether the extra field data stems from the localfile header.
-
mergeCentralDirectoryData
static Array<byte> mergeCentralDirectoryData(Array<ZipExtraField> data)
Merges the central directory fields of the given ZipExtraFields.
- Parameters:
data- an array of ExtraFields
-
mergeLocalFileDataData
static Array<byte> mergeLocalFileDataData(Array<ZipExtraField> data)
Merges the local file data fields of the given ZipExtraFields.
- Parameters:
data- an array of ExtraFiles
-
parse
static Array<ZipExtraField> parse(Array<byte> data)
Split the array into ExtraFields and populate them with thegiven data as local file data, throwing an exception if thedata cannot be parsed.
- Parameters:
data- an array of bytes as it appears in local file data
-
parse
static Array<ZipExtraField> parse(Array<byte> data, boolean local)
Split the array into ExtraFields and populate them with thegiven data, throwing an exception if the data cannot be parsed.
- Parameters:
data- an array of byteslocal- whether data originates from the local file dataor the central directory
-
parse
static Array<ZipExtraField> parse(Array<byte> data, boolean local, ExtraFieldParsingBehavior parsingBehavior)
Split the array into ExtraFields and populate them with thegiven data.
- Parameters:
data- an array of byteslocal- whether data originates from the local file dataor the central directoryparsingBehavior- controls parsing of extra fields.
-
parse
static Array<ZipExtraField> parse(Array<byte> data, boolean local, ExtraFieldUtils.UnparseableExtraField onUnparseableData)
Split the array into ExtraFields and populate them with thegiven data.
- Parameters:
data- an array of byteslocal- whether data originates from the local file dataor the central directoryonUnparseableData- what to do if the extra field datacannot be parsed.
-
register
static void register(Class<out Object> c)
Register a ZipExtraField implementation.
The given class must have a no-arg constructor and implementthe ZipExtraField interface.
- Parameters:
c- the class to register
-
-
-
-