Class J2KImageReader

  • All Implemented Interfaces:
    MsgLogger

    public class J2KImageReader
    extends javax.imageio.ImageReader
    implements MsgLogger
    This class is the Java Image IO plugin reader for JPEG 2000 JP2 image file format. It has the capability to load the compressed bilevel images, color-indexed byte images, or multi-band images in byte/ushort/short/int data type. It may subsample the image, select bands, clip the image, and shift the decoded image origin if the proper decoding parameter are set in the provided J2KImageReadParam.
    • Field Summary

      • Fields inherited from class javax.imageio.ImageReader

        availableLocales, ignoreMetadata, input, locale, minIndex, originatingProvider, progressListeners, seekForwardOnly, updateListeners, warningListeners, warningLocales
    • Constructor Summary

      Constructors 
      Constructor Description
      J2KImageReader​(javax.imageio.spi.ImageReaderSpi originator)
      Constructs J2KImageReader from the provided ImageReaderSpi.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean canReadRaster()  
      static void checkReadParamBandSettingsWrapper​(javax.imageio.ImageReadParam param, int numSrcBands, int numDstBands)
      Wrapper for the protected method checkReadParamBandSettings.
      static void computeRegionsWrapper​(javax.imageio.ImageReadParam param, boolean allowZeroDestOffset, int srcWidth, int srcHeight, java.awt.image.BufferedImage image, java.awt.Rectangle srcRegion, java.awt.Rectangle destRegion)
      Wrapper for the protected method computeRegions.
      void dispose()  
      void flush()
      Writes any buffered data from the println() method to the device.
      boolean getAbortRequest()
      This method wraps the protected method abortRequested to allow the abortions be monitored by J2KReadState.
      javax.imageio.ImageReadParam getDefaultReadParam()  
      int getHeight​(int imageIndex)  
      javax.imageio.metadata.IIOMetadata getImageMetadata​(int imageIndex)  
      java.util.Iterator getImageTypes​(int imageIndex)  
      int getNumImages​(boolean allowSearch)
      Overrides the method defined in the superclass.
      javax.imageio.metadata.IIOMetadata getStreamMetadata()  
      int getTileGridXOffset​(int imageIndex)  
      int getTileGridYOffset​(int imageIndex)  
      int getTileHeight​(int imageIndex)  
      int getTileWidth​(int imageIndex)  
      int getWidth​(int imageIndex)  
      boolean isImageTiled​(int imageIndex)  
      boolean isRandomAccessEasy​(int imageIndex)  
      void println​(java.lang.String str, int flind, int ind)
      Prints the string 'str' to the output device, appending a line return.
      void printmsg​(int sev, java.lang.String msg)
      Prints the message 'msg' to the output device, appending a newline, with severity 'sev'.
      void processImageProgressWrapper​(float percentageDone)
      Wrapper for the protected method processImageProgress So it can be access from the classes which are not in ImageReader hierarchy.
      void processImageUpdateWrapper​(java.awt.image.BufferedImage theImage, int minX, int minY, int width, int height, int periodX, int periodY, int[] bands)
      Wrapper for the protected method processImageUpdate So it can be access from the classes which are not in ImageReader hierarchy.
      java.awt.image.BufferedImage read​(int imageIndex, javax.imageio.ImageReadParam param)  
      java.awt.image.RenderedImage readAsRenderedImage​(int imageIndex, javax.imageio.ImageReadParam param)  
      void readHeader()  
      java.awt.image.Raster readRaster​(int imageIndex, javax.imageio.ImageReadParam param)  
      void reset()  
      void setInput​(java.lang.Object input, boolean seekForwardOnly, boolean ignoreMetadata)
      Overrides the method defined in the superclass.
      • Methods inherited from class javax.imageio.ImageReader

        abort, abortRequested, addIIOReadProgressListener, addIIOReadUpdateListener, addIIOReadWarningListener, checkReadParamBandSettings, clearAbortRequest, computeRegions, getAspectRatio, getAvailableLocales, getDestination, getFormatName, getImageMetadata, getInput, getLocale, getMinIndex, getNumThumbnails, getOriginatingProvider, getRawImageType, getSourceRegion, getStreamMetadata, getThumbnailHeight, getThumbnailWidth, hasThumbnails, isIgnoringMetadata, isSeekForwardOnly, processImageComplete, processImageProgress, processImageStarted, processImageUpdate, processPassComplete, processPassStarted, processReadAborted, processSequenceComplete, processSequenceStarted, processThumbnailComplete, processThumbnailPassComplete, processThumbnailPassStarted, processThumbnailProgress, processThumbnailStarted, processThumbnailUpdate, processWarningOccurred, processWarningOccurred, read, readAll, readAll, readerSupportsThumbnails, readThumbnail, readTile, readTileRaster, removeAllIIOReadProgressListeners, removeAllIIOReadUpdateListeners, removeAllIIOReadWarningListeners, removeIIOReadProgressListener, removeIIOReadUpdateListener, removeIIOReadWarningListener, setInput, setInput, setLocale
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • J2KImageReader

        public J2KImageReader​(javax.imageio.spi.ImageReaderSpi originator)
        Constructs J2KImageReader from the provided ImageReaderSpi.
    • Method Detail

      • computeRegionsWrapper

        public static void computeRegionsWrapper​(javax.imageio.ImageReadParam param,
                                                 boolean allowZeroDestOffset,
                                                 int srcWidth,
                                                 int srcHeight,
                                                 java.awt.image.BufferedImage image,
                                                 java.awt.Rectangle srcRegion,
                                                 java.awt.Rectangle destRegion)
        Wrapper for the protected method computeRegions. So it can be access from the classes which are not in ImageReader hierarchy.
      • checkReadParamBandSettingsWrapper

        public static void checkReadParamBandSettingsWrapper​(javax.imageio.ImageReadParam param,
                                                             int numSrcBands,
                                                             int numDstBands)
        Wrapper for the protected method checkReadParamBandSettings. So it can be access from the classes which are not in ImageReader hierarchy.
      • processImageUpdateWrapper

        public void processImageUpdateWrapper​(java.awt.image.BufferedImage theImage,
                                              int minX,
                                              int minY,
                                              int width,
                                              int height,
                                              int periodX,
                                              int periodY,
                                              int[] bands)
        Wrapper for the protected method processImageUpdate So it can be access from the classes which are not in ImageReader hierarchy.
      • processImageProgressWrapper

        public void processImageProgressWrapper​(float percentageDone)
        Wrapper for the protected method processImageProgress So it can be access from the classes which are not in ImageReader hierarchy.
      • setInput

        public void setInput​(java.lang.Object input,
                             boolean seekForwardOnly,
                             boolean ignoreMetadata)
        Overrides the method defined in the superclass.
        Overrides:
        setInput in class javax.imageio.ImageReader
      • getNumImages

        public int getNumImages​(boolean allowSearch)
                         throws java.io.IOException
        Overrides the method defined in the superclass.
        Specified by:
        getNumImages in class javax.imageio.ImageReader
        Throws:
        java.io.IOException
      • getWidth

        public int getWidth​(int imageIndex)
                     throws java.io.IOException
        Specified by:
        getWidth in class javax.imageio.ImageReader
        Throws:
        java.io.IOException
      • getHeight

        public int getHeight​(int imageIndex)
                      throws java.io.IOException
        Specified by:
        getHeight in class javax.imageio.ImageReader
        Throws:
        java.io.IOException
      • getTileGridXOffset

        public int getTileGridXOffset​(int imageIndex)
                               throws java.io.IOException
        Overrides:
        getTileGridXOffset in class javax.imageio.ImageReader
        Throws:
        java.io.IOException
      • getTileGridYOffset

        public int getTileGridYOffset​(int imageIndex)
                               throws java.io.IOException
        Overrides:
        getTileGridYOffset in class javax.imageio.ImageReader
        Throws:
        java.io.IOException
      • getTileWidth

        public int getTileWidth​(int imageIndex)
                         throws java.io.IOException
        Overrides:
        getTileWidth in class javax.imageio.ImageReader
        Throws:
        java.io.IOException
      • getTileHeight

        public int getTileHeight​(int imageIndex)
                          throws java.io.IOException
        Overrides:
        getTileHeight in class javax.imageio.ImageReader
        Throws:
        java.io.IOException
      • readHeader

        public void readHeader()
      • getImageTypes

        public java.util.Iterator getImageTypes​(int imageIndex)
                                         throws java.io.IOException
        Specified by:
        getImageTypes in class javax.imageio.ImageReader
        Throws:
        java.io.IOException
      • getDefaultReadParam

        public javax.imageio.ImageReadParam getDefaultReadParam()
        Overrides:
        getDefaultReadParam in class javax.imageio.ImageReader
      • getImageMetadata

        public javax.imageio.metadata.IIOMetadata getImageMetadata​(int imageIndex)
                                                            throws java.io.IOException
        Specified by:
        getImageMetadata in class javax.imageio.ImageReader
        Throws:
        java.io.IOException
      • getStreamMetadata

        public javax.imageio.metadata.IIOMetadata getStreamMetadata()
                                                             throws java.io.IOException
        Specified by:
        getStreamMetadata in class javax.imageio.ImageReader
        Throws:
        java.io.IOException
      • read

        public java.awt.image.BufferedImage read​(int imageIndex,
                                                 javax.imageio.ImageReadParam param)
                                          throws java.io.IOException
        Specified by:
        read in class javax.imageio.ImageReader
        Throws:
        java.io.IOException
      • readAsRenderedImage

        public java.awt.image.RenderedImage readAsRenderedImage​(int imageIndex,
                                                                javax.imageio.ImageReadParam param)
                                                         throws java.io.IOException
        Overrides:
        readAsRenderedImage in class javax.imageio.ImageReader
        Throws:
        java.io.IOException
      • canReadRaster

        public boolean canReadRaster()
        Overrides:
        canReadRaster in class javax.imageio.ImageReader
      • isRandomAccessEasy

        public boolean isRandomAccessEasy​(int imageIndex)
                                   throws java.io.IOException
        Overrides:
        isRandomAccessEasy in class javax.imageio.ImageReader
        Throws:
        java.io.IOException
      • readRaster

        public java.awt.image.Raster readRaster​(int imageIndex,
                                                javax.imageio.ImageReadParam param)
                                         throws java.io.IOException
        Overrides:
        readRaster in class javax.imageio.ImageReader
        Throws:
        java.io.IOException
      • isImageTiled

        public boolean isImageTiled​(int imageIndex)
        Overrides:
        isImageTiled in class javax.imageio.ImageReader
      • reset

        public void reset()
        Overrides:
        reset in class javax.imageio.ImageReader
      • getAbortRequest

        public boolean getAbortRequest()
        This method wraps the protected method abortRequested to allow the abortions be monitored by J2KReadState.
      • dispose

        public void dispose()
        Overrides:
        dispose in class javax.imageio.ImageReader
      • flush

        public void flush()
        Description copied from interface: MsgLogger
        Writes any buffered data from the println() method to the device.
        Specified by:
        flush in interface MsgLogger
      • println

        public void println​(java.lang.String str,
                            int flind,
                            int ind)
        Description copied from interface: MsgLogger
        Prints the string 'str' to the output device, appending a line return. The message is reformatted as appropriate to the particular diplaying device, where 'flind' and 'ind' are used as hints for performing that operation. However, any newlines appearing in 'str' are respected. The output device may not display the string until flush() is called. Some implementations may automatically flush when this method is called. This method just prints the string, the string does not make part of a "message" in the sense that no severity is associated to it.
        Specified by:
        println in interface MsgLogger
        Parameters:
        str - The string to print
        flind - Indentation of the first line
        ind - Indentation of any other lines.
      • printmsg

        public void printmsg​(int sev,
                             java.lang.String msg)
        Description copied from interface: MsgLogger
        Prints the message 'msg' to the output device, appending a newline, with severity 'sev'. Some implementations where the appended newline is irrelevant may not append the newline. Depending on the implementation the severity of the message may be added to it. The message is reformatted as appropriate for the output devic, but any newline characters are respected.
        Specified by:
        printmsg in interface MsgLogger
        Parameters:
        sev - The message severity (LOG, INFO, etc.)
        msg - The message to display