java.lang.Object
org.apache.commons.compress.archivers.sevenz.CoderBase
Direct Known Subclasses:
AES256SHA256Decoder, Coders.BCJDecoder, Coders.BZIP2Decoder, Coders.CopyDecoder, Coders.Deflate64Decoder, Coders.DeflateDecoder, DeltaDecoder, LZMA2Decoder, LZMADecoder

abstract class CoderBase extends Object
Base Codec class.
  • Field Details

    • acceptableOptions

      private final Class<?>[] acceptableOptions
  • Constructor Details

    • CoderBase

      protected CoderBase(Class<?>... acceptableOptions)
      Parameters:
      acceptableOptions - types that can be used as options for this codec.
  • Method Details

    • canAcceptOptions

      boolean canAcceptOptions(Object opts)
      Returns:
      whether this method can extract options from the given object.
    • getOptionsAsProperties

      byte[] getOptionsAsProperties(Object options) throws IOException
      Returns:
      property-bytes to write in a Folder block
      Throws:
      IOException
    • getOptionsFromCoder

      Object getOptionsFromCoder(Coder coder, InputStream in) throws IOException
      Returns:
      configuration options that have been used to create the given InputStream from the given Coder
      Throws:
      IOException
    • decode

      abstract InputStream decode(String archiveName, InputStream in, long uncompressedLength, Coder coder, byte[] password, int maxMemoryLimitInKb) throws IOException
      Returns:
      a stream that reads from in using the configured coder and password.
      Throws:
      IOException
    • encode

      OutputStream encode(OutputStream out, Object options) throws IOException
      Returns:
      a stream that writes to out using the given configuration.
      Throws:
      IOException
    • numberOptionOrDefault

      protected static int numberOptionOrDefault(Object options, int defaultValue)
      If the option represents a number, return its integer value, otherwise return the given default value.