org.apache.commons.compress.archivers.zip

## Interface ExtraFieldParsingBehavior

- All Superinterfaces:
    UnparseableExtraFieldBehavior
  All Known Implementing Classes:
    ZipArchiveEntry.ExtraFieldParsingMode

      public interface ExtraFieldParsingBehavior
      extends UnparseableExtraFieldBehavior

  Controls details of parsing zip extra fields.
  Since:
    1.19

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    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.

    - ### Methods inherited from interface org.apache.commons.compress.archivers.zip.UnparseableExtraFieldBehavior

      `onUnparseableExtraField`

- - ### Method Detail

    - #### createExtraField

          ZipExtraField createExtraField(ZipShort headerId)
                                  throws ZipException,
                                         InstantiationException,
                                         IllegalAccessException

      Creates an instance of ZipExtraField for the given id.

      A good default implementation would be `ExtraFieldUtils.createExtraField(org.apache.commons.compress.archivers.zip.ZipShort)`.

      Parameters:
        `headerId` - the id for the extra field
      Returns:
        an instance of ZipExtraField, must not be `null`
      Throws:
        `ZipException` - if an error occurs
        `InstantiationException` - if unable to instantiate the class
        `IllegalAccessException` - if not allowed to instantiate the class

    - #### fill

          ZipExtraField fill(ZipExtraField field,
                             byte[] data,
                             int off,
                             int len,
                             boolean local)
                      throws ZipException

      Fills in the extra field data for a single extra field.

      A good default implementation would be `ExtraFieldUtils.fillExtraField(org.apache.commons.compress.archivers.zip.ZipExtraField, byte[], int, int, boolean)`.

      Parameters:
        `field` - the extra field instance to fill
        `data` - the array of extra field data
        `off` - offset into data where this field's data starts
        `len` - the length of this field's 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.
      Returns:
        the filled field. Usually this is the same as `field` but it could be a replacement extra field as well. Must not be `null`.
      Throws:
        `ZipException` - if an error occurs

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