Class ExtraFieldUtils.UnparseableExtraField
java.lang.Object
org.apache.commons.compress.archivers.zip.ExtraFieldUtils.UnparseableExtraField
- All Implemented Interfaces:
UnparseableExtraFieldBehavior
- Enclosing class:
- ExtraFieldUtils
public static final class ExtraFieldUtils.UnparseableExtraField
extends Object
implements UnparseableExtraFieldBehavior
"enum" for the possible actions to take if the extra field cannot be parsed.
This class has been created long before Java 5 and would have been a real enum ever since.
- Since:
- 1.1
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ExtraFieldUtils.UnparseableExtraFieldRead the extra field data into an instance ofUnparseableExtraFieldData.static final intKey for "read" action.static final ExtraFieldUtils.UnparseableExtraFieldSkip the extra field entirely and don't make its data available - effectively removing the extra field data.static final intKey for "skip" action.static final ExtraFieldUtils.UnparseableExtraFieldThrow an exception if field cannot be parsed.static final intKey for "throw an exception" action. -
Method Summary
Modifier and TypeMethodDescriptionintgetKey()Key of the action to take.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.
-
Field Details
-
THROW_KEY
Key for "throw an exception" action.- See Also:
-
SKIP_KEY
Key for "skip" action.- See Also:
-
READ_KEY
Key for "read" action.- See Also:
-
THROW
Throw an exception if field cannot be parsed. -
SKIP
Skip the extra field entirely and don't make its data available - effectively removing the extra field data. -
READ
Read the extra field data into an instance ofUnparseableExtraFieldData.
-
-
Method Details
-
getKey
Key of the action to take.- Returns:
- the key
-
onUnparseableExtraField
public ZipExtraField onUnparseableExtraField(byte[] data, int off, int len, boolean local, int claimedLength) throws ZipException Description copied from interface:UnparseableExtraFieldBehaviorDecides what to do with extra field data that doesn't follow the recommended pattern.- Specified by:
onUnparseableExtraFieldin interfaceUnparseableExtraFieldBehavior- 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 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 pattern- Returns:
- null if the data should be ignored or an extra field implementation that represents the data
- Throws:
ZipException- if an error occurs or unparseable extra fields must not be accepted
-