public static enum ZipArchiveEntry.ExtraFieldParsingMode extends java.lang.Enum<ZipArchiveEntry.ExtraFieldParsingMode> implements ExtraFieldParsingBehavior
Configures the behavior for:
Enum Constant and Description |
---|
BEST_EFFORT
Try to parse as many extra fields as possible and wrap
unknown extra fields as well as supported extra fields that
cannot be parsed in
UnrecognizedExtraField . |
DRACONIC
Throw an exception if any of the recognized extra fields
cannot be parsed or any extra field violates the
recommended pattern.
|
ONLY_PARSEABLE_LENIENT
Try to parse as many extra fields as possible and wrap
unknown extra fields as well as supported extra fields that
cannot be parsed in
UnrecognizedExtraField . |
ONLY_PARSEABLE_STRICT
Try to parse as many extra fields as possible and wrap
unknown extra fields in
UnrecognizedExtraField . |
STRICT_FOR_KNOW_EXTRA_FIELDS
Try to parse as many extra fields as possible and wrap
unknown extra fields in
UnrecognizedExtraField . |
Modifier and Type | Method and Description |
---|---|
ZipExtraField |
createExtraField(ZipShort headerId)
Creates an instance of ZipExtraField for the given id.
|
ZipExtraField |
fill(ZipExtraField field,
byte[] data,
int off,
int len,
boolean local)
Fills in the extra field data for a single extra field.
|
ZipExtraField |
onUnparseableExtraField(byte[] data,
int off,
int len,
boolean local,
int claimedLength)
Decides what to do with extra field data that doesn't follow the recommended pattern.
|
static ZipArchiveEntry.ExtraFieldParsingMode |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
|
static ZipArchiveEntry.ExtraFieldParsingMode[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final ZipArchiveEntry.ExtraFieldParsingMode BEST_EFFORT
UnrecognizedExtraField
.
Wrap extra data that doesn't follow the recommended
pattern in an UnparseableExtraFieldData
instance.
This is the default behavior starting with Commons Compress 1.19.
public static final ZipArchiveEntry.ExtraFieldParsingMode STRICT_FOR_KNOW_EXTRA_FIELDS
UnrecognizedExtraField
.
Wrap extra data that doesn't follow the recommended
pattern in an UnparseableExtraFieldData
instance.
Throw an exception if an extra field that is generally supported cannot be parsed.
This used to be the default behavior prior to Commons Compress 1.19.
public static final ZipArchiveEntry.ExtraFieldParsingMode ONLY_PARSEABLE_LENIENT
UnrecognizedExtraField
.
Ignore extra data that doesn't follow the recommended pattern.
public static final ZipArchiveEntry.ExtraFieldParsingMode ONLY_PARSEABLE_STRICT
UnrecognizedExtraField
.
Ignore extra data that doesn't follow the recommended pattern.
Throw an exception if an extra field that is generally supported cannot be parsed.
public static final ZipArchiveEntry.ExtraFieldParsingMode DRACONIC
public static ZipArchiveEntry.ExtraFieldParsingMode[] values()
for (ZipArchiveEntry.ExtraFieldParsingMode c : ZipArchiveEntry.ExtraFieldParsingMode.values()) System.out.println(c);
public static ZipArchiveEntry.ExtraFieldParsingMode valueOf(java.lang.String name)
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic ZipExtraField onUnparseableExtraField(byte[] data, int off, int len, boolean local, int claimedLength) throws java.util.zip.ZipException
UnparseableExtraFieldBehavior
onUnparseableExtraField
in interface UnparseableExtraFieldBehavior
data
- the array of extra field dataoff
- offset into data where the unparseable data startslen
- the length of unparseable datalocal
- 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.claimedLength
- length of the extra field claimed by the
third and forth byte if it did follow the recommended patternjava.util.zip.ZipException
- if an error occurs or unparseable extra
fields must not be acceptedpublic ZipExtraField createExtraField(ZipShort headerId) throws java.util.zip.ZipException, java.lang.InstantiationException, java.lang.IllegalAccessException
ExtraFieldParsingBehavior
A good default implementation would be ExtraFieldUtils.createExtraField(org.apache.commons.compress.archivers.zip.ZipShort)
.
createExtraField
in interface ExtraFieldParsingBehavior
headerId
- the id for the extra fieldnull
java.util.zip.ZipException
- if an error occursjava.lang.InstantiationException
- if unable to instantiate the classjava.lang.IllegalAccessException
- if not allowed to instantiate the classpublic ZipExtraField fill(ZipExtraField field, byte[] data, int off, int len, boolean local) throws java.util.zip.ZipException
ExtraFieldParsingBehavior
A good default implementation would be ExtraFieldUtils.fillExtraField(org.apache.commons.compress.archivers.zip.ZipExtraField, byte[], int, int, boolean)
.
fill
in interface ExtraFieldParsingBehavior
field
- 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 local
file header. If this is false then the data is part if the
central directory header extra data.field
but it could be a replacement extra field as well. Must
not be null
.java.util.zip.ZipException
- if an error occursCopyright © 2010 - 2023 Adobe. All Rights Reserved