loci.formats.codec

## Class JPEGXRCodec

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

- All Implemented Interfaces:
    Codec

      public class JPEGXRCodec
      extends BaseCodec

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private JPEGXRService` | `service`

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

      `LOGGER`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `JPEGXRCodec()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `byte[]` | `compress(byte[] data, CodecOptions options)` Compresses a block of data.
    `byte[]` | `decompress(byte[] buf, CodecOptions options)` The CodecOptions parameter should have the following fields set: `maxBytes` `interleaved` `bitsPerSample` `littleEndian` `width` `height`
    `byte[]` | `decompress(loci.common.RandomAccessInputStream in, CodecOptions options)` Decompresses data from the given RandomAccessInputStream.
    `private void` | `initialize()` Initializes the JPEG-XR dependency service.

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

      `compress, decompress, decompress, decompress, test`

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

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

- - ### Field Detail

    - #### service

          private JPEGXRService service

  - ### Constructor Detail

    - #### JPEGXRCodec

          public JPEGXRCodec()

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

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

    - #### decompress

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

      The CodecOptions parameter should have the following fields set: `maxBytes` `interleaved` `bitsPerSample` `littleEndian` `width` `height`
      Specified by:
        `decompress` in interface `Codec`
      Overrides:
        `decompress` in class `BaseCodec`
      Parameters:
        `buf` - the data to be decompressed
        `options` - Options to be used during decompression.
      Returns:
        the decompressed data.
      Throws:
        `FormatException` - If data is not valid.
      See Also:
        `Codec.decompress(byte[], CodecOptions)`

    - #### initialize

          private void initialize()
                           throws FormatException

      Initializes the JPEG-XR dependency service. This is called at the beginning of the `decompress(loci.common.RandomAccessInputStream, loci.formats.codec.CodecOptions)` method to avoid having the constructor's method definition contain a checked exception.
      Throws:
        `FormatException` - If there is an error initializing JPEG-XR services.

Copyright © 2026 Open Microscopy Environment