-
- All Implemented Interfaces:
-
java.io.Serializable,java.lang.Comparable,org.readium.r2.shared.util.zip.compress.archivers.zip.ExtraFieldParsingBehavior,org.readium.r2.shared.util.zip.compress.archivers.zip.UnparseableExtraFieldBehavior
public enum ZipArchiveEntry.ExtraFieldParsingMode implements ExtraFieldParsingBehavior
How to try to parse the extra fields.
Configures the behavior for:
- What shall happen if the extra field content doesn'tfollow the recommended pattern of two-byte id followed by atwo-byte length?
- What shall happen if an extra field is generally supportedby Commons Compress but its content cannot be parsedcorrectly? This may for example happen if the archive iscorrupt, it triggers a bug in Commons Compress or the extrafield uses a version not (yet) supported by CommonsCompress.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description DRACONICThrow an exception if any of the recognized extra fieldscannot be parsed or any extra field violates therecommended pattern.
ONLY_PARSEABLE_STRICTTry to parse as many extra fields as possible and wrapunknown extra fields in UnrecognizedExtraField.
Ignore extra data that doesn't follow the recommendedpattern.
Throw an exception if an extra field that is generallysupported cannot be parsed.
ONLY_PARSEABLE_LENIENTTry to parse as many extra fields as possible and wrapunknown extra fields as well as supported extra fields thatcannot be parsed in UnrecognizedExtraField.
Ignore extra data that doesn't follow the recommendedpattern.
STRICT_FOR_KNOW_EXTRA_FIELDSTry to parse as many extra fields as possible and wrapunknown extra fields in UnrecognizedExtraField.
Wrap extra data that doesn't follow the recommendedpattern in an UnparseableExtraFieldData instance.
Throw an exception if an extra field that is generallysupported cannot be parsed.
This used to be the default behavior prior to CommonsCompress 1.19.
BEST_EFFORTTry to parse as many extra fields as possible and wrapunknown extra fields as well as supported extra fields thatcannot be parsed in UnrecognizedExtraField.
Wrap extra data that doesn't follow the recommendedpattern in an UnparseableExtraFieldData instance.
This is the default behavior starting with Commons Compress 1.19.
-
Method Summary
Modifier and Type Method Description ZipExtraFieldcreateExtraField(ZipShort headerId)Creates an instance of ZipExtraField for the given id. ZipExtraFieldfill(ZipExtraField field, Array<byte> data, int off, int len, boolean local)Fills in the extra field data for a single extra field. ZipExtraFieldonUnparseableExtraField(Array<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 Array<ZipArchiveEntry.ExtraFieldParsingMode>values()static ZipArchiveEntry.ExtraFieldParsingModevalueOf(String name)-
Methods inherited from class org.readium.r2.shared.util.zip.compress.archivers.zip.ExtraFieldParsingBehavior
fill -
Methods inherited from class org.readium.r2.shared.util.zip.compress.archivers.zip.UnparseableExtraFieldBehavior
onUnparseableExtraField -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
createExtraField
ZipExtraField createExtraField(ZipShort headerId)
- Parameters:
headerId- the id for the extra field
-
fill
ZipExtraField fill(ZipExtraField field, Array<byte> data, int off, int len, boolean local)
- Parameters:
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 localfile header.
-
onUnparseableExtraField
ZipExtraField onUnparseableExtraField(Array<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.
- Parameters:
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 localfile header.claimedLength- length of the extra field claimed by thethird and forth byte if it did follow the recommended pattern
-
values
static Array<ZipArchiveEntry.ExtraFieldParsingMode> values()
-
valueOf
static ZipArchiveEntry.ExtraFieldParsingMode valueOf(String name)
-
-
-
-