it.tidalwave.imageio.crw
Class CRWImageReader

java.lang.Object
  extended by javax.imageio.ImageReader
      extended by it.tidalwave.imageio.raw.RAWImageReaderSupport
          extended by it.tidalwave.imageio.crw.CRWImageReader

public class CRWImageReader
extends RAWImageReaderSupport

Version:
CVS $Id: CRWImageReader.java,v 1.6 2006/02/15 13:53:52 fabriziogiudici Exp $
Author:
Fabrizio Giudici

Field Summary
 
Fields inherited from class it.tidalwave.imageio.raw.RAWImageReaderSupport
headerProcessor, iis, makerNote, metadata, metadataLoaded, primaryDirectory
 
Fields inherited from class javax.imageio.ImageReader
availableLocales, ignoreMetadata, input, locale, minIndex, originatingProvider, progressListeners, seekForwardOnly, updateListeners, warningListeners, warningLocales
 
Constructor Summary
protected CRWImageReader(javax.imageio.spi.ImageReaderSpi originatingProvider)
           
 
Method Summary
protected  void checkThumbnailIndex(int thumbnailIndex)
           
protected  RAWMetadataSupport createMetadata(Directory primaryDirectory, Directory imageDirector)
          This method must be implemented by concrete subclasses to create an instance of RAWMetadataSupport.
protected  void disposeAll()
          Releases all the allocated resources.
 int getHeight(int imageIndex)
           
 int getNumThumbnails(int imageIndex)
           
 int getThumbnailHeight(int imageIndex, int thumbnailIndex)
           
 int getThumbnailWidth(int imageIndex, int thumbnailIndex)
           
 int getWidth(int imageIndex)
           
protected  Directory loadPrimaryDirectory()
          Loads the primary directory.
protected  java.awt.image.WritableRaster loadRAWRaster()
          This method must be implemented by concrete subclasses to load an image raster.
protected  java.awt.image.BufferedImage loadThumbnail(int imageIndex, int thumbnailIndex)
          This method must be implemented by concrete subclasses to load a thumbnail.
protected  void processEXIFAndMakerNote(Directory directory, RAWImageInputStream iis)
          Processes the EXIF metadata, if present.
protected  void processMakerNote(RAWImageInputStream iis)
          Processes the maker note.
protected  void processMetadata()
          Analyzes and sets various variables to point at different pieces of metadata.
protected  java.lang.Object wrapInput(java.lang.Object input)
          Gives a chance to use a decorator for the input object.
 
Methods inherited from class it.tidalwave.imageio.raw.RAWImageReaderSupport
checkImageIndex, checkMetadataIsLoaded, createImage, dispose, ensureMetadataIsLoaded, failure, getImageMetadata, getImageTypes, getNumImages, getStreamMetadata, loadEmbeddedImage, loadImage, loadMetadata, loadRAWImage, processImageProgress, read, readerSupportsThumbnails, readThumbnail, reset, setInput
 
Methods inherited from class javax.imageio.ImageReader
abort, abortRequested, addIIOReadProgressListener, addIIOReadUpdateListener, addIIOReadWarningListener, canReadRaster, checkReadParamBandSettings, clearAbortRequest, computeRegions, getAspectRatio, getAvailableLocales, getDefaultReadParam, getDestination, getFormatName, getImageMetadata, getInput, getLocale, getMinIndex, getOriginatingProvider, getRawImageType, getSourceRegion, getStreamMetadata, getTileGridXOffset, getTileGridYOffset, getTileHeight, getTileWidth, hasThumbnails, isIgnoringMetadata, isImageTiled, isRandomAccessEasy, isSeekForwardOnly, processImageComplete, processImageStarted, processImageUpdate, processPassComplete, processPassStarted, processReadAborted, processSequenceComplete, processSequenceStarted, processThumbnailComplete, processThumbnailPassComplete, processThumbnailPassStarted, processThumbnailProgress, processThumbnailStarted, processThumbnailUpdate, processWarningOccurred, processWarningOccurred, read, readAll, readAll, readAsRenderedImage, readRaster, 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

CRWImageReader

protected CRWImageReader(javax.imageio.spi.ImageReaderSpi originatingProvider)
Method Detail

getNumThumbnails

public int getNumThumbnails(int imageIndex)
                     throws java.io.IOException
Overrides:
getNumThumbnails 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

getThumbnailWidth

public int getThumbnailWidth(int imageIndex,
                             int thumbnailIndex)
                      throws java.io.IOException
Overrides:
getThumbnailWidth in class javax.imageio.ImageReader
Throws:
java.io.IOException

getThumbnailHeight

public int getThumbnailHeight(int imageIndex,
                              int thumbnailIndex)
                       throws java.io.IOException
Overrides:
getThumbnailHeight in class javax.imageio.ImageReader
Throws:
java.io.IOException

loadPrimaryDirectory

protected Directory loadPrimaryDirectory()
                                  throws java.io.IOException
Description copied from class: RAWImageReaderSupport
Loads the primary directory.

Specified by:
loadPrimaryDirectory in class RAWImageReaderSupport
Returns:
the primary directory
Throws:
java.io.IOException - if an I/O error occurs

loadThumbnail

protected java.awt.image.BufferedImage loadThumbnail(int imageIndex,
                                                     int thumbnailIndex)
                                              throws java.io.IOException
Description copied from class: RAWImageReaderSupport
This method must be implemented by concrete subclasses to load a thumbnail.

Specified by:
loadThumbnail in class RAWImageReaderSupport
Parameters:
imageIndex - the index of the image
thumbnailIndex - the index of the thumbnail to load
Returns:
the loaded thumbnail
Throws:
java.io.IOException - if an I/O error occurs

loadRAWRaster

protected java.awt.image.WritableRaster loadRAWRaster()
                                               throws java.io.IOException
Description copied from class: RAWImageReaderSupport
This method must be implemented by concrete subclasses to load an image raster.

Specified by:
loadRAWRaster in class RAWImageReaderSupport
Returns:
the loaded raster
Throws:
java.io.IOException - if an I/O error occurs

checkThumbnailIndex

protected void checkThumbnailIndex(int thumbnailIndex)

processMetadata

protected void processMetadata()
                        throws java.io.IOException
Description copied from class: RAWImageReaderSupport
Analyzes and sets various variables to point at different pieces of metadata.

Specified by:
processMetadata in class RAWImageReaderSupport
Throws:
java.io.IOException - if an I/O error occurs

disposeAll

protected void disposeAll()
Releases all the allocated resources.

Overrides:
disposeAll in class RAWImageReaderSupport

wrapInput

protected java.lang.Object wrapInput(java.lang.Object input)
Description copied from class: RAWImageReaderSupport
Gives a chance to use a decorator for the input object. By default a RAWImageInputStream is wrapped. Subclasses may change this behaviour by overriding this method.

Overrides:
wrapInput in class RAWImageReaderSupport
Parameters:
input - the input object
Returns:
the decorated object

processEXIFAndMakerNote

protected void processEXIFAndMakerNote(Directory directory,
                                       RAWImageInputStream iis)
                                throws java.io.IOException
Processes the EXIF metadata, if present. The EXIF data is added to the imageMetadata. The MakerNote is processed too.

Parameters:
directory - the primary directory
iis - the image input stream
Throws:
java.io.IOException - if an I/O error occurs

createMetadata

protected RAWMetadataSupport createMetadata(Directory primaryDirectory,
                                            Directory imageDirector)
Description copied from class: RAWImageReaderSupport
This method must be implemented by concrete subclasses to create an instance of RAWMetadataSupport. Each SPI should use its own subclass.

Specified by:
createMetadata in class RAWImageReaderSupport
Parameters:
primaryDirectory - the primary directory
imageDirector - the image directory
Returns:
the raw metadata

processMakerNote

protected void processMakerNote(RAWImageInputStream iis)
                         throws java.io.IOException
Processes the maker note. FIXME: try to merge with super implementation.

Parameters:
iis - the ImageInputStream
Throws:
java.io.IOException - if an I/O error occurs