org.libjpegturbo.turbojpeg

## Class TJDecompressor

- java.lang.Object
- - org.libjpegturbo.turbojpeg.TJDecompressor

- All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable
  Direct Known Subclasses:
    TJTransformer

      public class TJDecompressor
      extends java.lang.Object
      implements java.io.Closeable

  TurboJPEG decompressor

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected long` | `handle`
    `protected byte[]` | `jpegBuf`
    `protected int` | `jpegBufSize`
    `protected int` | `jpegColorspace`
    `protected int` | `jpegHeight`
    `protected int` | `jpegSubsamp`
    `protected int` | `jpegWidth`
    `protected YUVImage` | `yuvImage`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TJDecompressor()` Create a TurboJPEG decompresssor instance.
    `TJDecompressor(byte[] jpegImage)` Create a TurboJPEG decompressor instance and associate the JPEG source image stored in `jpegImage` with the newly created instance.
    `TJDecompressor(byte[] jpegImage, int imageSize)` Create a TurboJPEG decompressor instance and associate the JPEG source image of length `imageSize` bytes stored in `jpegImage` with the newly created instance.
    `TJDecompressor(YUVImage yuvImage)` Create a TurboJPEG decompressor instance and associate the YUV planar source image stored in `yuvImage` with the newly created instance.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()` Free the native structures associated with this decompressor instance.
    `void` | `decompress(java.awt.image.BufferedImage dstImage, int flags)` Decompress the JPEG source image or decode the YUV source image associated with this decompressor instance and output a decompressed/decoded image to the given `BufferedImage` instance.
    `void` | `decompress(byte[] dstBuf, int desiredWidth, int pitch, int desiredHeight, int pixelFormat, int flags)` Deprecated. Use `decompress(byte[], int, int, int, int, int, int, int)` instead.
    `void` | `decompress(byte[] dstBuf, int x, int y, int desiredWidth, int pitch, int desiredHeight, int pixelFormat, int flags)` Decompress the JPEG source image or decode the YUV source image associated with this decompressor instance and output a grayscale, RGB, or CMYK image to the given destination buffer.
    `void` | `decompress(int[] dstBuf, int x, int y, int desiredWidth, int stride, int desiredHeight, int pixelFormat, int flags)` Decompress the JPEG source image or decode the YUV source image associated with this decompressor instance and output a grayscale, RGB, or CMYK image to the given destination buffer.
    `java.awt.image.BufferedImage` | `decompress(int desiredWidth, int desiredHeight, int bufferedImageType, int flags)` Decompress the JPEG source image or decode the YUV source image associated with this decompressor instance and return a `BufferedImage` instance containing the decompressed/decoded image.
    `byte[]` | `decompress(int desiredWidth, int pitch, int desiredHeight, int pixelFormat, int flags)` Decompress the JPEG source image associated with this decompressor instance and return a buffer containing the decompressed image.
    `void` | `decompressToYUV(byte[] dstBuf, int flags)` Deprecated. Use `decompressToYUV(YUVImage, int)` instead.
    `byte[]` | `decompressToYUV(int flags)` Deprecated. Use `decompressToYUV(int, int, int, int)` instead.
    `YUVImage` | `decompressToYUV(int desiredWidth, int[] strides, int desiredHeight, int flags)` Decompress the JPEG source image associated with this decompressor instance into a set of Y, U (Cb), and V (Cr) image planes and return a `YUVImage` instance containing the decompressed image planes.
    `YUVImage` | `decompressToYUV(int desiredWidth, int pad, int desiredHeight, int flags)` Decompress the JPEG source image associated with this decompressor instance into a unified YUV planar image buffer and return a `YUVImage` instance containing the decompressed image.
    `void` | `decompressToYUV(YUVImage dstImage, int flags)` Decompress the JPEG source image associated with this decompressor instance into a YUV planar image and store it in the given `YUVImage` instance.
    `protected void` | `finalize()`
    `int` | `getColorspace()` Returns the colorspace used in the source image (JPEG or YUV) associated with this decompressor instance.
    `int` | `getHeight()` Returns the height of the source image (JPEG or YUV) associated with this decompressor instance.
    `byte[]` | `getJPEGBuf()` Returns the JPEG image buffer associated with this decompressor instance.
    `int` | `getJPEGSize()` Returns the size of the JPEG image (in bytes) associated with this decompressor instance.
    `int` | `getScaledHeight(int desiredWidth, int desiredHeight)` Returns the height of the largest scaled-down image that the TurboJPEG decompressor can generate without exceeding the desired image width and height.
    `int` | `getScaledWidth(int desiredWidth, int desiredHeight)` Returns the width of the largest scaled-down image that the TurboJPEG decompressor can generate without exceeding the desired image width and height.
    `int` | `getSubsamp()` Returns the level of chrominance subsampling used in the source image (JPEG or YUV) associated with this decompressor instance.
    `int` | `getWidth()` Returns the width of the source image (JPEG or YUV) associated with this decompressor instance.
    `void` | `setJPEGImage(byte[] jpegImage, int imageSize)` Deprecated. Use `setSourceImage(byte[], int)` instead.
    `void` | `setSourceImage(byte[] jpegImage, int imageSize)` Associate the JPEG image of length `imageSize` bytes stored in `jpegImage` with this decompressor instance.
    `void` | `setSourceImage(YUVImage srcImage)` Associate the specified YUV planar source image with this decompressor instance.

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

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

- - ### Field Detail

    - #### handle

          protected long handle

    - #### jpegBuf

          protected byte[] jpegBuf

    - #### jpegBufSize

          protected int jpegBufSize

    - #### yuvImage

          protected YUVImage yuvImage

    - #### jpegWidth

          protected int jpegWidth

    - #### jpegHeight

          protected int jpegHeight

    - #### jpegSubsamp

          protected int jpegSubsamp

    - #### jpegColorspace

          protected int jpegColorspace

  - ### Constructor Detail

    - #### TJDecompressor

          public TJDecompressor()
                         throws TJException

      Create a TurboJPEG decompresssor instance.
      Throws:
        `TJException`

    - #### TJDecompressor

          public TJDecompressor(byte[] jpegImage)
                         throws TJException

      Create a TurboJPEG decompressor instance and associate the JPEG source image stored in `jpegImage` with the newly created instance.
      Parameters:
        `jpegImage` - JPEG image buffer (size of the JPEG image is assumed to be the length of the array.) This buffer is not modified.
      Throws:
        `TJException`

    - #### TJDecompressor

          public TJDecompressor(byte[] jpegImage,
                        int imageSize)
                         throws TJException

      Create a TurboJPEG decompressor instance and associate the JPEG source image of length `imageSize` bytes stored in `jpegImage` with the newly created instance.
      Parameters:
        `jpegImage` - JPEG image buffer. This buffer is not modified.
        `imageSize` - size of the JPEG image (in bytes)
      Throws:
        `TJException`

    - #### TJDecompressor

          public TJDecompressor(YUVImage yuvImage)
                         throws TJException

      Create a TurboJPEG decompressor instance and associate the YUV planar source image stored in `yuvImage` with the newly created instance.
      Parameters:
        `yuvImage` - `YUVImage` instance containing a YUV planar image to be decoded. This image is not modified.
      Throws:
        `TJException`

  - ### Method Detail

    - #### setSourceImage

          public void setSourceImage(byte[] jpegImage,
                            int imageSize)
                              throws TJException

      Associate the JPEG image of length `imageSize` bytes stored in `jpegImage` with this decompressor instance. This image will be used as the source image for subsequent decompress operations.
      Parameters:
        `jpegImage` - JPEG image buffer. This buffer is not modified.
        `imageSize` - size of the JPEG image (in bytes)
      Throws:
        `TJException`

    - #### setJPEGImage

          @Deprecated
          public void setJPEGImage(byte[] jpegImage,
                                     int imageSize)
                            throws TJException

      Deprecated. Use `setSourceImage(byte[], int)` instead.
      Throws:
        `TJException`

    - #### setSourceImage

          public void setSourceImage(YUVImage srcImage)

      Associate the specified YUV planar source image with this decompressor instance. Subsequent decompress operations will decode this image into an RGB or grayscale destination image.
      Parameters:
        `srcImage` - `YUVImage` instance containing a YUV planar image to be decoded. This image is not modified.

    - #### getWidth

          public int getWidth()

      Returns the width of the source image (JPEG or YUV) associated with this decompressor instance.
      Returns:
        the width of the source image (JPEG or YUV) associated with this decompressor instance.

    - #### getHeight

          public int getHeight()

      Returns the height of the source image (JPEG or YUV) associated with this decompressor instance.
      Returns:
        the height of the source image (JPEG or YUV) associated with this decompressor instance.

    - #### getSubsamp

          public int getSubsamp()

      Returns the level of chrominance subsampling used in the source image (JPEG or YUV) associated with this decompressor instance. See `TJ.SAMP_*`.
      Returns:
        the level of chrominance subsampling used in the source image (JPEG or YUV) associated with this decompressor instance.

    - #### getColorspace

          public int getColorspace()

      Returns the colorspace used in the source image (JPEG or YUV) associated with this decompressor instance. See `TJ.CS_*`. If the source image is YUV, then this always returns `TJ.CS_YCbCr`.
      Returns:
        the colorspace used in the source image (JPEG or YUV) associated with this decompressor instance.

    - #### getJPEGBuf

          public byte[] getJPEGBuf()

      Returns the JPEG image buffer associated with this decompressor instance.
      Returns:
        the JPEG image buffer associated with this decompressor instance.

    - #### getJPEGSize

          public int getJPEGSize()

      Returns the size of the JPEG image (in bytes) associated with this decompressor instance.
      Returns:
        the size of the JPEG image (in bytes) associated with this decompressor instance.

    - #### getScaledWidth

          public int getScaledWidth(int desiredWidth,
                           int desiredHeight)

      Returns the width of the largest scaled-down image that the TurboJPEG decompressor can generate without exceeding the desired image width and height.
      Parameters:
        `desiredWidth` - desired width (in pixels) of the decompressed image. Setting this to 0 is the same as setting it to the width of the JPEG image (in other words, the width will not be considered when determining the scaled image size.)
        `desiredHeight` - desired height (in pixels) of the decompressed image. Setting this to 0 is the same as setting it to the height of the JPEG image (in other words, the height will not be considered when determining the scaled image size.)
      Returns:
        the width of the largest scaled-down image that the TurboJPEG decompressor can generate without exceeding the desired image width and height.

    - #### getScaledHeight

          public int getScaledHeight(int desiredWidth,
                            int desiredHeight)

      Returns the height of the largest scaled-down image that the TurboJPEG decompressor can generate without exceeding the desired image width and height.
      Parameters:
        `desiredWidth` - desired width (in pixels) of the decompressed image. Setting this to 0 is the same as setting it to the width of the JPEG image (in other words, the width will not be considered when determining the scaled image size.)
        `desiredHeight` - desired height (in pixels) of the decompressed image. Setting this to 0 is the same as setting it to the height of the JPEG image (in other words, the height will not be considered when determining the scaled image size.)
      Returns:
        the height of the largest scaled-down image that the TurboJPEG decompressor can generate without exceeding the desired image width and height.

    - #### decompress

          public void decompress(byte[] dstBuf,
                        int x,
                        int y,
                        int desiredWidth,
                        int pitch,
                        int desiredHeight,
                        int pixelFormat,
                        int flags)
                          throws TJException

      Decompress the JPEG source image or decode the YUV source image associated with this decompressor instance and output a grayscale, RGB, or CMYK image to the given destination buffer.

      NOTE: The output image is fully recoverable if this method throws a non-fatal `TJException` (unless `TJ.FLAG_STOPONWARNING` is specified.)

      Parameters:
        `dstBuf` - buffer that will receive the decompressed/decoded image. If the source image is a JPEG image, then this buffer should normally be `pitch * scaledHeight` bytes in size, where `scaledHeight` can be determined by calling `scalingFactor.`getScaled`(jpegHeight)` with one of the scaling factors returned from `TJ.getScalingFactors()` or by calling `getScaledHeight(int, int)`. If the source image is a YUV image, then this buffer should normally be `pitch * height` bytes in size, where `height` is the height of the YUV image. However, the buffer may also be larger than the dimensions of the source image, in which case the `x`, `y`, and `pitch` parameters can be used to specify the region into which the source image should be decompressed/decoded.
        `x` - x offset (in pixels) of the region in the destination image into which the source image should be decompressed/decoded
        `y` - y offset (in pixels) of the region in the destination image into which the source image should be decompressed/decoded
        `desiredWidth` - If the source image is a JPEG image, then this specifies the desired width (in pixels) of the decompressed image (or image region.) If the desired destination image dimensions are different than the source image dimensions, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired dimensions. Setting this to 0 is the same as setting it to the width of the JPEG image (in other words, the width will not be considered when determining the scaled image size.) This parameter is ignored if the source image is a YUV image.
        `pitch` - bytes per line of the destination image. Normally, this should be set to `scaledWidth * TJ.pixelSize(pixelFormat)` if the destination image is unpadded, but you can use this to, for instance, pad each line of the destination image to a 4-byte boundary or to decompress/decode the source image into a region of a larger image. NOTE: if the source image is a JPEG image, then `scaledWidth` can be determined by calling `scalingFactor.`getScaled`(jpegWidth)` or by calling `getScaledWidth(int, int)`. If the source image is a YUV image, then `scaledWidth` is the width of the YUV image. Setting this parameter to 0 is the equivalent of setting it to `scaledWidth * TJ.pixelSize(pixelFormat)`.
        `desiredHeight` - If the source image is a JPEG image, then this specifies the desired height (in pixels) of the decompressed image (or image region.) If the desired destination image dimensions are different than the source image dimensions, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired dimensions. Setting this to 0 is the same as setting it to the height of the JPEG image (in other words, the height will not be considered when determining the scaled image size.) This parameter is ignored if the source image is a YUV image.
        `pixelFormat` - pixel format of the decompressed/decoded image (one of `TJ.PF_*`)
        `flags` - the bitwise OR of one or more of `TJ.FLAG_*`
      Throws:
        `TJException`

    - #### decompress

          @Deprecated
          public void decompress(byte[] dstBuf,
                                   int desiredWidth,
                                   int pitch,
                                   int desiredHeight,
                                   int pixelFormat,
                                   int flags)
                          throws TJException

      Deprecated. Use `decompress(byte[], int, int, int, int, int, int, int)` instead.
      Throws:
        `TJException`

    - #### decompress

          public byte[] decompress(int desiredWidth,
                          int pitch,
                          int desiredHeight,
                          int pixelFormat,
                          int flags)
                            throws TJException

      Decompress the JPEG source image associated with this decompressor instance and return a buffer containing the decompressed image.
      Parameters:
        `desiredWidth` - see `decompress(byte[], int, int, int, int, int, int, int)` for description
        `pitch` - see `decompress(byte[], int, int, int, int, int, int, int)` for description
        `desiredHeight` - see `decompress(byte[], int, int, int, int, int, int, int)` for description
        `pixelFormat` - pixel format of the decompressed image (one of `TJ.PF_*`)
        `flags` - the bitwise OR of one or more of `TJ.FLAG_*`
      Returns:
        a buffer containing the decompressed image.
      Throws:
        `TJException`

    - #### decompressToYUV

          public void decompressToYUV(YUVImage dstImage,
                             int flags)
                               throws TJException

      Decompress the JPEG source image associated with this decompressor instance into a YUV planar image and store it in the given `YUVImage` instance. This method performs JPEG decompression but leaves out the color conversion step, so a planar YUV image is generated instead of an RGB or grayscale image. This method cannot be used to decompress JPEG source images with the CMYK or YCCK colorspace.

      NOTE: The YUV planar output image is fully recoverable if this method throws a non-fatal `TJException` (unless `TJ.FLAG_STOPONWARNING` is specified.)

      Parameters:
        `dstImage` - `YUVImage` instance that will receive the YUV planar image. The level of subsampling specified in this `YUVImage` instance must match that of the JPEG image, and the width and height specified in the `YUVImage` instance must match one of the scaled image sizes that TurboJPEG is capable of generating from the JPEG source image.
        `flags` - the bitwise OR of one or more of `TJ.FLAG_*`
      Throws:
        `TJException`

    - #### decompressToYUV

          @Deprecated
          public void decompressToYUV(byte[] dstBuf,
                                        int flags)
                               throws TJException

      Deprecated. Use `decompressToYUV(YUVImage, int)` instead.
      Throws:
        `TJException`

    - #### decompressToYUV

          public YUVImage decompressToYUV(int desiredWidth,
                                 int[] strides,
                                 int desiredHeight,
                                 int flags)
                                   throws TJException

      Decompress the JPEG source image associated with this decompressor instance into a set of Y, U (Cb), and V (Cr) image planes and return a `YUVImage` instance containing the decompressed image planes. This method performs JPEG decompression but leaves out the color conversion step, so a planar YUV image is generated instead of an RGB or grayscale image. This method cannot be used to decompress JPEG source images with the CMYK or YCCK colorspace.
      Parameters:
        `desiredWidth` - desired width (in pixels) of the YUV image. If the desired image dimensions are different than the dimensions of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired dimensions. Setting this to 0 is the same as setting it to the width of the JPEG image (in other words, the width will not be considered when determining the scaled image size.)
        `strides` - an array of integers, each specifying the number of bytes per line in the corresponding plane of the output image. Setting the stride for any plane to 0 is the same as setting it to the scaled component width of the plane. If `strides` is NULL, then the strides for all planes will be set to their respective scaled component widths. You can adjust the strides in order to add an arbitrary amount of line padding to each plane.
        `desiredHeight` - desired height (in pixels) of the YUV image. If the desired image dimensions are different than the dimensions of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired dimensions. Setting this to 0 is the same as setting it to the height of the JPEG image (in other words, the height will not be considered when determining the scaled image size.)
        `flags` - the bitwise OR of one or more of `TJ.FLAG_*`
      Returns:
        a YUV planar image.
      Throws:
        `TJException`

    - #### decompressToYUV

          public YUVImage decompressToYUV(int desiredWidth,
                                 int pad,
                                 int desiredHeight,
                                 int flags)
                                   throws TJException

      Decompress the JPEG source image associated with this decompressor instance into a unified YUV planar image buffer and return a `YUVImage` instance containing the decompressed image. This method performs JPEG decompression but leaves out the color conversion step, so a planar YUV image is generated instead of an RGB or grayscale image. This method cannot be used to decompress JPEG source images with the CMYK or YCCK colorspace.
      Parameters:
        `desiredWidth` - desired width (in pixels) of the YUV image. If the desired image dimensions are different than the dimensions of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired dimensions. Setting this to 0 is the same as setting it to the width of the JPEG image (in other words, the width will not be considered when determining the scaled image size.)
        `pad` - the width of each line in each plane of the YUV image will be padded to the nearest multiple of this number of bytes (must be a power of 2.)
        `desiredHeight` - desired height (in pixels) of the YUV image. If the desired image dimensions are different than the dimensions of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired dimensions. Setting this to 0 is the same as setting it to the height of the JPEG image (in other words, the height will not be considered when determining the scaled image size.)
        `flags` - the bitwise OR of one or more of `TJ.FLAG_*`
      Returns:
        a YUV planar image.
      Throws:
        `TJException`

    - #### decompressToYUV

          @Deprecated
          public byte[] decompressToYUV(int flags)
                                 throws TJException

      Deprecated. Use `decompressToYUV(int, int, int, int)` instead.
      Throws:
        `TJException`

    - #### decompress

          public void decompress(int[] dstBuf,
                        int x,
                        int y,
                        int desiredWidth,
                        int stride,
                        int desiredHeight,
                        int pixelFormat,
                        int flags)
                          throws TJException

      Decompress the JPEG source image or decode the YUV source image associated with this decompressor instance and output a grayscale, RGB, or CMYK image to the given destination buffer.

      NOTE: The output image is fully recoverable if this method throws a non-fatal `TJException` (unless `TJ.FLAG_STOPONWARNING` is specified.)

      Parameters:
        `dstBuf` - buffer that will receive the decompressed/decoded image. If the source image is a JPEG image, then this buffer should normally be `stride * scaledHeight` pixels in size, where `scaledHeight` can be determined by calling `scalingFactor.`getScaled`(jpegHeight)` with one of the scaling factors returned from `TJ.getScalingFactors()` or by calling `getScaledHeight(int, int)`. If the source image is a YUV image, then this buffer should normally be `stride * height` pixels in size, where `height` is the height of the YUV image. However, the buffer may also be larger than the dimensions of the JPEG image, in which case the `x`, `y`, and `stride` parameters can be used to specify the region into which the source image should be decompressed.
        `x` - x offset (in pixels) of the region in the destination image into which the source image should be decompressed/decoded
        `y` - y offset (in pixels) of the region in the destination image into which the source image should be decompressed/decoded
        `desiredWidth` - If the source image is a JPEG image, then this specifies the desired width (in pixels) of the decompressed image (or image region.) If the desired destination image dimensions are different than the source image dimensions, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired dimensions. Setting this to 0 is the same as setting it to the width of the JPEG image (in other words, the width will not be considered when determining the scaled image size.) This parameter is ignored if the source image is a YUV image.
        `stride` - pixels per line of the destination image. Normally, this should be set to `scaledWidth`, but you can use this to, for instance, decompress the JPEG image into a region of a larger image. NOTE: if the source image is a JPEG image, then `scaledWidth` can be determined by calling `scalingFactor.`getScaled`(jpegWidth)` or by calling `getScaledWidth(int, int)`. If the source image is a YUV image, then `scaledWidth` is the width of the YUV image. Setting this parameter to 0 is the equivalent of setting it to `scaledWidth`.
        `desiredHeight` - If the source image is a JPEG image, then this specifies the desired height (in pixels) of the decompressed image (or image region.) If the desired destination image dimensions are different than the source image dimensions, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired dimensions. Setting this to 0 is the same as setting it to the height of the JPEG image (in other words, the height will not be considered when determining the scaled image size.) This parameter is ignored if the source image is a YUV image.
        `pixelFormat` - pixel format of the decompressed image (one of `TJ.PF_*`)
        `flags` - the bitwise OR of one or more of `TJ.FLAG_*`
      Throws:
        `TJException`

    - #### decompress

          public void decompress(java.awt.image.BufferedImage dstImage,
                        int flags)
                          throws TJException

      Decompress the JPEG source image or decode the YUV source image associated with this decompressor instance and output a decompressed/decoded image to the given `BufferedImage` instance.

      NOTE: The output image is fully recoverable if this method throws a non-fatal `TJException` (unless `TJ.FLAG_STOPONWARNING` is specified.)

      Parameters:
        `dstImage` - a `BufferedImage` instance that will receive the decompressed/decoded image. If the source image is a JPEG image, then the width and height of the `BufferedImage` instance must match one of the scaled image sizes that TurboJPEG is capable of generating from the JPEG image. If the source image is a YUV image, then the width and height of the `BufferedImage` instance must match the width and height of the YUV image.
        `flags` - the bitwise OR of one or more of `TJ.FLAG_*`
      Throws:
        `TJException`

    - #### decompress

          public java.awt.image.BufferedImage decompress(int desiredWidth,
                                                int desiredHeight,
                                                int bufferedImageType,
                                                int flags)
                                                  throws TJException

      Decompress the JPEG source image or decode the YUV source image associated with this decompressor instance and return a `BufferedImage` instance containing the decompressed/decoded image.
      Parameters:
        `desiredWidth` - see `decompress(byte[], int, int, int, int, int, int, int)` for description
        `desiredHeight` - see `decompress(byte[], int, int, int, int, int, int, int)` for description
        `bufferedImageType` - the image type of the `BufferedImage` instance that will be created (for instance, `BufferedImage.TYPE_INT_RGB`)
        `flags` - the bitwise OR of one or more of `TJ.FLAG_*`
      Returns:
        a `BufferedImage` instance containing the decompressed/decoded image.
      Throws:
        `TJException`

    - #### close

          public void close()
                     throws TJException

      Free the native structures associated with this decompressor instance.
      Specified by:
        `close` in interface `java.io.Closeable`
      Specified by:
        `close` in interface `java.lang.AutoCloseable`
      Throws:
        `TJException`

    - #### finalize

          protected void finalize()
                           throws java.lang.Throwable

      Overrides:
        `finalize` in class `java.lang.Object`
      Throws:
        `java.lang.Throwable`