loci.formats.codec

## Class WrappedCodec

- java.lang.Object
- - loci.formats.codec.BaseCodec
  - - loci.formats.codec.WrappedCodec

- All Implemented Interfaces:
    Codec
  Direct Known Subclasses:
    Base64Codec, HuffmanCodec, JPEG2000Codec, JPEGCodec, LosslessJPEGCodec, LZOCodec, LZWCodec, MJPBCodec, MSRLECodec, MSVideoCodec, PackbitsCodec, PassthroughCodec, QTRLECodec, RPZACodec, ZlibCodec, ZstdCodec

      class WrappedCodec
      extends BaseCodec

  Generic wrapper for codecs from ome-codecs. Individual wrapper codec classes should extend this class and pass the class to wrap to the constructor.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected ome.codecs.Codec` | `codec`

    - ### Fields inherited from class loci.formats.codec.BaseCodec

      `LOGGER`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `WrappedCodec(ome.codecs.Codec codec)` Construct with a codec implementation to wrap.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `byte[]` | `compress(byte[][] data, CodecOptions options)` 2D data block encoding default implementation.
    `byte[]` | `compress(byte[] data, CodecOptions options)` Compresses a block of data.
    `private static void` | `copyOptions(CodecOptions src, ome.codecs.CodecOptions dest)`
    `byte[]` | `decompress(byte[] data)` Decompresses a block of data.
    `byte[]` | `decompress(byte[][] data)` Decompresses a block of data.
    `byte[]` | `decompress(byte[][] data, CodecOptions options)` 2D data block decoding default implementation.
    `byte[]` | `decompress(byte[] data, CodecOptions options)` Decompresses a block of data.
    `byte[]` | `decompress(loci.common.RandomAccessInputStream in, CodecOptions options)` Decompresses data from the given RandomAccessInputStream.
    `protected static ome.codecs.CodecOptions` | `getOptions(CodecOptions options)`
    `(package private) static FormatException` | `unwrapCodecException(ome.codecs.CodecException e)`

    - ### Methods inherited from class loci.formats.codec.BaseCodec

      `test`

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

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

- - ### Field Detail

    - #### codec

          protected ome.codecs.Codec codec

  - ### Constructor Detail

    - #### WrappedCodec

          protected WrappedCodec(ome.codecs.Codec codec)

      Construct with a codec implementation to wrap.
      Parameters:
        `codec` - the codec to wrap.

  - ### Method Detail

    - #### compress

          public byte[] compress(byte[] data,
                                 CodecOptions options)
                          throws FormatException

      Description copied from interface: `Codec`
      Compresses a block of data.
      Parameters:
        `data` - The data to be compressed.
        `options` - Options to be used during compression, if appropriate.
      Returns:
        The compressed data.
      Throws:
        `FormatException` - If input is not a compressed data block of the appropriate type.

    - #### compress

          public byte[] compress(byte[][] data,
                                 CodecOptions options)
                          throws FormatException

      Description copied from class: `BaseCodec`
      2D data block encoding default implementation. This method simply concatenates data[0] + data[1] + ... + data[i] into a 1D block of data, then calls the 1D version of compress.
      Specified by:
        `compress` in interface `Codec`
      Overrides:
        `compress` in class `BaseCodec`
      Parameters:
        `data` - The data to be compressed.
        `options` - Options to be used during compression, if appropriate.
      Returns:
        The compressed data.
      Throws:
        `FormatException` - If input is not a compressed data block of the appropriate type.

    - #### decompress

          public byte[] decompress(byte[] data,
                                   CodecOptions options)
                            throws FormatException

      Description copied from interface: `Codec`
      Decompresses a block of data.
      Specified by:
        `decompress` in interface `Codec`
      Overrides:
        `decompress` in class `BaseCodec`
      Parameters:
        `data` - the data to be decompressed
        `options` - Options to be used during decompression.
      Returns:
        the decompressed data.
      Throws:
        `FormatException` - If data is not valid.

    - #### decompress

          public byte[] decompress(byte[][] data,
                                   CodecOptions options)
                            throws FormatException

      Description copied from class: `BaseCodec`
      2D data block decoding default implementation. This method simply concatenates data[0] + data[1] + ... + data[i] into a 1D block of data, then calls the 1D version of decompress.
      Specified by:
        `decompress` in interface `Codec`
      Overrides:
        `decompress` in class `BaseCodec`
      Parameters:
        `data` - The data to be decompressed.
        `options` - Options to be used during decompression.
      Returns:
        The decompressed data.
      Throws:
        `FormatException` - If input is not a compressed data block of the appropriate type.

    - #### decompress

          public byte[] decompress(byte[] data)
                            throws FormatException

      Description copied from interface: `Codec`
      Decompresses a block of data.
      Specified by:
        `decompress` in interface `Codec`
      Overrides:
        `decompress` in class `BaseCodec`
      Parameters:
        `data` - the data to be decompressed.
      Returns:
        The decompressed data.
      Throws:
        `FormatException` - If data is not valid compressed data for this decompressor.

    - #### decompress

          public byte[] decompress(byte[][] data)
                            throws FormatException

      Description copied from interface: `Codec`
      Decompresses a block of data.
      Specified by:
        `decompress` in interface `Codec`
      Overrides:
        `decompress` in class `BaseCodec`
      Parameters:
        `data` - The data to be decompressed.
      Returns:
        The decompressed data.
      Throws:
        `FormatException` - If data is not valid compressed data for this decompressor.

    - #### decompress

          public byte[] decompress(loci.common.RandomAccessInputStream in,
                                   CodecOptions options)
                            throws FormatException,
                                   java.io.IOException

      Description copied from interface: `Codec`
      Decompresses data from the given RandomAccessInputStream.
      Specified by:
        `decompress` in interface `Codec`
      Specified by:
        `decompress` in class `BaseCodec`
      Parameters:
        `in` - The stream from which to read compressed data.
        `options` - Options to be used during decompression.
      Returns:
        The decompressed data.
      Throws:
        `FormatException` - If data is not valid compressed data for this decompressor.
        `java.io.IOException`

    - #### copyOptions

          private static void copyOptions(CodecOptions src,
                                          ome.codecs.CodecOptions dest)
                                   throws FormatException

      Throws:
        `FormatException`

    - #### getOptions

          protected static ome.codecs.CodecOptions getOptions(CodecOptions options)
                                                       throws FormatException

      Throws:
        `FormatException`

    - #### unwrapCodecException

          static FormatException unwrapCodecException(ome.codecs.CodecException e)

Copyright © 2026 Open Microscopy Environment