Class ThumbsDBImageReader

java.lang.Object
javax.imageio.ImageReader
com.twelvemonkeys.imageio.ImageReaderBase
com.twelvemonkeys.imageio.plugins.thumbsdb.ThumbsDBImageReader

public final class ThumbsDBImageReader extends ImageReaderBase
ThumbsDBImageReader
Version:
$Id: ThumbsDBImageReader.java,v 1.0 22.jan.2007 18:49:38 haku Exp$
Author:
Harald Kuhr, last modified by $Author: haku$
See Also:
  • Constructor Details

    • ThumbsDBImageReader

      public ThumbsDBImageReader()
    • ThumbsDBImageReader

      protected ThumbsDBImageReader(ThumbsDBImageReaderSpi pProvider)
  • Method Details

    • resetMembers

      protected void resetMembers()
      Description copied from class: ImageReaderBase
      Resets all member variables. This method is by default invoked from:
      Specified by:
      resetMembers in class ImageReaderBase
    • dispose

      public void dispose()
      Overrides:
      dispose in class ImageReaderBase
    • isLoadEagerly

      public boolean isLoadEagerly()
    • setLoadEagerly

      public void setLoadEagerly(boolean pLoadEagerly)
      Instructs the reader wether it should read and cache alle thumbnails in sequence, during the first read operation.

      This is useful mainly if you need to read all the thumbnails, and you need them in random order, as it requires less repositioning in the underlying stream.

      Parameters:
      pLoadEagerly - true if the reader should read all thumbs on first read
    • read

      public BufferedImage read(int pIndex, ImageReadParam pParam) throws IOException
      Reads the image data from the given input stream, and returns it as a BufferedImage.
      Specified by:
      read in class ImageReader
      Parameters:
      pIndex - the index of the image to read
      pParam - additional parameters used while decoding, may be null, in which case defaults will be used
      Returns:
      a BufferedImage
      Throws:
      IndexOutOfBoundsException - if pIndex is out of bounds
      IllegalStateException - if the input source has not been set
      IOException - if an error occurs during reading
    • read

      public BufferedImage read(String pName, ImageReadParam pParam) throws IOException
      Reads the image data from the given input stream, and returns it as a BufferedImage.
      Parameters:
      pName - the name of the image to read
      pParam - additional parameters used while decoding, may be null, in which case defaults will be used
      Returns:
      a BufferedImage
      Throws:
      FileNotFoundException - if the given file name is not found in the "Catalog" entry of the CompoundDocument
      IllegalStateException - if the input source has not been set
      IOException - if an error occurs during reading
    • abort

      public void abort()
      Overrides:
      abort in class ImageReader
    • setInput

      public void setInput(Object input, boolean seekForwardOnly, boolean ignoreMetadata)
      Description copied from class: ImageReaderBase
      Overrides setInput, to allow easy access to the input, in case it is an ImageInputStream.
      Overrides:
      setInput in class ImageReaderBase
      Parameters:
      input - the ImageInputStream or other Object to use for future decoding.
      seekForwardOnly - if true, images and metadata may only be read in ascending order from this input source.
      ignoreMetadata - if true, metadata may be ignored during reads.
      See Also:
    • getNumImages

      public int getNumImages(boolean allowSearch) throws IOException
      Description copied from class: ImageReaderBase
      Default implementation that always returns 1.
      Overrides:
      getNumImages in class ImageReaderBase
      Parameters:
      allowSearch - ignored, unless overridden
      Returns:
      1, unless overridden
      Throws:
      IOException - never, unless overridden
    • getWidth

      public int getWidth(int pIndex) throws IOException
      Specified by:
      getWidth in class ImageReader
      Throws:
      IOException
    • getHeight

      public int getHeight(int pIndex) throws IOException
      Specified by:
      getHeight in class ImageReader
      Throws:
      IOException
    • getImageTypes

      public Iterator<ImageTypeSpecifier> getImageTypes(int pIndex) throws IOException
      Specified by:
      getImageTypes in class ImageReader
      Throws:
      IOException
    • isPresent

      public boolean isPresent(String pFileName)
    • main

      public static void main(String[] pArgs) throws IOException
      Test code below
      Throws:
      IOException