org.apache.commons.compress.archivers.zip

## 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

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static ExtraFieldUtils.UnparseableExtraField` | `READ` Read the extra field data into an instance of `UnparseableExtraFieldData`.
    `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 and 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.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### 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 of `UnparseableExtraFieldData`.

  - ### 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 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 interface `UnparseableExtraFieldBehavior`
      Parameters:
        `data` - the array of extra field data
        `off` - offset into data where the unparseable data starts
        `len` - the length of unparseable data
        `local` - 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

Copyright © 2002–2020 The Apache Software Foundation. All rights reserved.