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 java.lang.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
Fields Modifier and Type Field Description static ExtraFieldUtils.UnparseableExtraField
READ
Read the extra field data into an instance ofUnparseableExtraFieldData
.static int
READ_KEY
Key for "read" action.static ExtraFieldUtils.UnparseableExtraField
SKIP
Skip the extra field entirely and don't make its data available - effectively removing the extra field data.static int
SKIP_KEY
Key for "skip" action.static ExtraFieldUtils.UnparseableExtraField
THROW
Throw an exception if field cannot be parsed.static int
THROW_KEY
Key for "throw an exception" action.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getKey()
Key of the action to take.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.
-
-
-
Field Detail
-
THROW_KEY
public static final int THROW_KEY
Key for "throw an exception" action.- See Also:
- Constant Field Values
-
SKIP_KEY
public static final int SKIP_KEY
Key for "skip" action.- See Also:
- Constant Field Values
-
READ_KEY
public static final int READ_KEY
Key for "read" action.- See Also:
- Constant Field Values
-
THROW
public static final ExtraFieldUtils.UnparseableExtraField THROW
Throw an exception if field cannot be parsed.
-
SKIP
public static final ExtraFieldUtils.UnparseableExtraField SKIP
Skip the extra field entirely and don't make its data available - effectively removing the extra field data.
-
READ
public static final ExtraFieldUtils.UnparseableExtraField READ
Read the extra field data into an instance ofUnparseableExtraFieldData
.
-
-
Method Detail
-
getKey
public int 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 java.util.zip.ZipException
Description copied from interface:UnparseableExtraFieldBehavior
Decides what to do with extra field data that doesn't follow the recommended pattern.- Specified by:
onUnparseableExtraField
in 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:
java.util.zip.ZipException
- if an error occurs or unparseable extra fields must not be accepted
-
-