Class UnrecognizedExtraField

java.lang.Object
org.apache.tools.zip.UnrecognizedExtraField
All Implemented Interfaces:
CentralDirectoryParsingZipExtraField, ZipExtraField

public class UnrecognizedExtraField extends Object implements CentralDirectoryParsingZipExtraField
Simple placeholder for all those extra fields we don't want to deal with.

Assumes local file data and central directory entries are identical - unless told the opposite.

  • Constructor Details

    • UnrecognizedExtraField

      public UnrecognizedExtraField()
  • Method Details

    • setHeaderId

      public void setHeaderId(ZipShort headerId)
      Set the header id.
      Parameters:
      headerId - the header id to use
    • getHeaderId

      public ZipShort getHeaderId()
      Get the header id.
      Specified by:
      getHeaderId in interface ZipExtraField
      Returns:
      the header id
    • setLocalFileDataData

      public void setLocalFileDataData(byte[] data)
      Set the extra field data in the local file data - without Header-ID or length specifier.
      Parameters:
      data - the field data to use
    • getLocalFileDataLength

      public ZipShort getLocalFileDataLength()
      Get the length of the local data.
      Specified by:
      getLocalFileDataLength in interface ZipExtraField
      Returns:
      the length of the local data
    • getLocalFileDataData

      public byte[] getLocalFileDataData()
      Get the local data.
      Specified by:
      getLocalFileDataData in interface ZipExtraField
      Returns:
      the local data
    • setCentralDirectoryData

      public void setCentralDirectoryData(byte[] data)
      Set the extra field data in central directory.
      Parameters:
      data - the data to use
    • getCentralDirectoryLength

      public ZipShort getCentralDirectoryLength()
      Get the central data length. If there is no central data, get the local file data length.
      Specified by:
      getCentralDirectoryLength in interface ZipExtraField
      Returns:
      the central data length
    • getCentralDirectoryData

      public byte[] getCentralDirectoryData()
      Get the central data.
      Specified by:
      getCentralDirectoryData in interface ZipExtraField
      Returns:
      the central data if present, else return the local file data
    • parseFromLocalFileData

      public void parseFromLocalFileData(byte[] data, int offset, int length)
      Description copied from interface: ZipExtraField
      Populate data from this array as if it was in local file data.
      Specified by:
      parseFromLocalFileData in interface ZipExtraField
      Parameters:
      data - the array of bytes.
      offset - the source location in the data array.
      length - the number of bytes to use in the data array.
      See Also:
    • parseFromCentralDirectoryData

      public void parseFromCentralDirectoryData(byte[] data, int offset, int length)
      Description copied from interface: CentralDirectoryParsingZipExtraField
      Populate data from this array as if it was in central directory data.
      Specified by:
      parseFromCentralDirectoryData in interface CentralDirectoryParsingZipExtraField
      Parameters:
      data - the array of bytes.
      offset - the source location in the data array.
      length - the number of bytes to use in the data array.