jp2codec.imageio
Class JP2ImageReader

java.lang.Object
  extended by javax.imageio.ImageReader
      extended by jp2codec.imageio.JP2ImageReader

public class JP2ImageReader
extends javax.imageio.ImageReader

This class is responsible for responding to queries about the images actually stored in an input file or stream, as well as the actual reading of images, thumbnails, and metadata. For simplicity, we will ignore thumbnail images in this class.


Field Summary
static int COLOR_TYPE_GRAY
           
static int COLOR_TYPE_RGB
           
static int COLOR_TYPE_RGBA
           
 
Fields inherited from class javax.imageio.ImageReader
availableLocales, ignoreMetadata, input, locale, minIndex, originatingProvider, progressListeners, seekForwardOnly, updateListeners, warningListeners, warningLocales
 
Constructor Summary
JP2ImageReader(javax.imageio.spi.ImageReaderSpi originatingProvider)
          The constructor of JP2ImageReader
 
Method Summary
 java.lang.String getFormatName()
           
 int getHeight(int imageIndex)
          Returns height of the image
 javax.imageio.metadata.IIOMetadata getImageMetadata(int imageIndex)
           
 java.util.Iterator<javax.imageio.ImageTypeSpecifier> getImageTypes(int imageIndex)
           
 int getNumImages(boolean allowSearch)
          Returns 1 since multi-image files are not supported
 javax.imageio.metadata.IIOMetadata getStreamMetadata()
           
 int getWidth(int imageIndex)
          Returns width of the image
 java.awt.image.BufferedImage read(int imageIndex, javax.imageio.ImageReadParam param)
           
 void setROI(int x, int y, int w, int h)
           
 
Methods inherited from class javax.imageio.ImageReader
abort, abortRequested, addIIOReadProgressListener, addIIOReadUpdateListener, addIIOReadWarningListener, canReadRaster, checkReadParamBandSettings, clearAbortRequest, computeRegions, dispose, getAspectRatio, getAvailableLocales, getDefaultReadParam, getDestination, getImageMetadata, getInput, getLocale, getMinIndex, getNumThumbnails, getOriginatingProvider, getRawImageType, getSourceRegion, getStreamMetadata, getThumbnailHeight, getThumbnailWidth, getTileGridXOffset, getTileGridYOffset, getTileHeight, getTileWidth, hasThumbnails, isIgnoringMetadata, isImageTiled, isRandomAccessEasy, isSeekForwardOnly, processImageComplete, processImageProgress, processImageStarted, processImageUpdate, processPassComplete, processPassStarted, processReadAborted, processSequenceComplete, processSequenceStarted, processThumbnailComplete, processThumbnailPassComplete, processThumbnailPassStarted, processThumbnailProgress, processThumbnailStarted, processThumbnailUpdate, processWarningOccurred, processWarningOccurred, read, readAll, readAll, readAsRenderedImage, readerSupportsThumbnails, readRaster, readThumbnail, readTile, readTileRaster, removeAllIIOReadProgressListeners, removeAllIIOReadUpdateListeners, removeAllIIOReadWarningListeners, removeIIOReadProgressListener, removeIIOReadUpdateListener, removeIIOReadWarningListener, reset, setInput, setInput, setInput, setLocale
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COLOR_TYPE_GRAY

public static final int COLOR_TYPE_GRAY
See Also:
Constant Field Values

COLOR_TYPE_RGB

public static final int COLOR_TYPE_RGB
See Also:
Constant Field Values

COLOR_TYPE_RGBA

public static final int COLOR_TYPE_RGBA
See Also:
Constant Field Values
Constructor Detail

JP2ImageReader

public JP2ImageReader(javax.imageio.spi.ImageReaderSpi originatingProvider)
The constructor of JP2ImageReader

Method Detail

getNumImages

public int getNumImages(boolean allowSearch)
                 throws java.io.IOException
Returns 1 since multi-image files are not supported

Specified by:
getNumImages in class javax.imageio.ImageReader
Parameters:
allowSearch -
Returns:
1
Throws:
java.io.IOException

getWidth

public int getWidth(int imageIndex)
             throws java.io.IOException
Returns width of the image

Specified by:
getWidth in class javax.imageio.ImageReader
Parameters:
imageIndex - The image index
Returns:
Width of the image
Throws:
java.io.IOException

getHeight

public int getHeight(int imageIndex)
              throws java.io.IOException
Returns height of the image

Specified by:
getHeight in class javax.imageio.ImageReader
Parameters:
imageIndex - The image index
Returns:
Width of the image
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

getFormatName

public java.lang.String getFormatName()
                               throws java.io.IOException
Overrides:
getFormatName in class javax.imageio.ImageReader
Throws:
java.io.IOException

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

getImageTypes

public java.util.Iterator<javax.imageio.ImageTypeSpecifier> getImageTypes(int imageIndex)
                                                                   throws java.io.IOException
Specified by:
getImageTypes in class javax.imageio.ImageReader
Throws:
java.io.IOException

setROI

public void setROI(int x,
                   int y,
                   int w,
                   int h)

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