Class ThumbsDBImageReader
java.lang.Object
javax.imageio.ImageReader
com.twelvemonkeys.imageio.ImageReaderBase
com.twelvemonkeys.imageio.plugins.thumbsdb.ThumbsDBImageReader
ThumbsDBImageReader
- Version:
- $Id: ThumbsDBImageReader.java,v 1.0 22.jan.2007 18:49:38 haku Exp$
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Catalog
private int
private boolean
private final ImageReader
private Entry
private static final int
private BufferedImage[]
Fields inherited from class com.twelvemonkeys.imageio.ImageReaderBase
imageInput
Fields inherited from class javax.imageio.ImageReader
availableLocales, ignoreMetadata, input, locale, minIndex, originatingProvider, progressListeners, seekForwardOnly, updateListeners, warningListeners, warningLocales
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
abort()
private static void
addImage
(Container pParent, ImageReader pReader, int pImageNo, String pName) private static ImageReader
createJPEGReader
(ThumbsDBImageReaderSpi pProvider) private static JFrame
createWindow
(String pTitle) void
dispose()
int
getHeight
(int pIndex) getImageTypes
(int pIndex) int
getNumImages
(boolean allowSearch) Default implementation that always returns1
.int
getWidth
(int pIndex) private void
init()
private void
init
(int pIndex) private void
private void
initReader
(int pIndex) private void
boolean
boolean
static void
read
(int pIndex, ImageReadParam pParam) Reads the image data from the given input stream, and returns it as aBufferedImage
.read
(String pName, ImageReadParam pParam) Reads the image data from the given input stream, and returns it as aBufferedImage
.protected void
Resets all member variables.void
OverridessetInput
, to allow easy access to the input, in case it is anImageInputStream
.void
setLoadEagerly
(boolean pLoadEagerly) Instructs the reader wether it should read and cache alle thumbnails in sequence, during the first read operation.Methods inherited from class com.twelvemonkeys.imageio.ImageReaderBase
assertInput, checkBounds, fakeAOI, fakeSubsampling, getDestination, getImageMetadata, getStreamMetadata, hasExplicitDestination, reset, showIt
Methods inherited from class javax.imageio.ImageReader
abortRequested, addIIOReadProgressListener, addIIOReadUpdateListener, addIIOReadWarningListener, canReadRaster, checkReadParamBandSettings, clearAbortRequest, computeRegions, getAspectRatio, getAvailableLocales, getDefaultReadParam, getFormatName, 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, setInput, setInput, setLocale
-
Field Details
-
THUMBNAIL_OFFSET
private static final int THUMBNAIL_OFFSET- See Also:
-
root
-
catalog
-
thumbnails
-
reader
-
currentImage
private int currentImage -
loadEagerly
private boolean loadEagerly
-
-
Constructor Details
-
ThumbsDBImageReader
public ThumbsDBImageReader() -
ThumbsDBImageReader
-
-
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 classImageReaderBase
-
createJPEGReader
-
dispose
public void dispose()- Overrides:
dispose
in classImageReaderBase
-
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
Reads the image data from the given input stream, and returns it as aBufferedImage
.- Specified by:
read
in classImageReader
- Parameters:
pIndex
- the index of the image to readpParam
- additional parameters used while decoding, may benull
, in which case defaults will be used- Returns:
- a
BufferedImage
- Throws:
IndexOutOfBoundsException
- ifpIndex
is out of boundsIllegalStateException
- if the input source has not been setIOException
- if an error occurs during reading
-
read
Reads the image data from the given input stream, and returns it as aBufferedImage
.- Parameters:
pName
- the name of the image to readpParam
- additional parameters used while decoding, may benull
, 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 theCompoundDocument
IllegalStateException
- if the input source has not been setIOException
- if an error occurs during reading
-
abort
public void abort()- Overrides:
abort
in classImageReader
-
setInput
Description copied from class:ImageReaderBase
OverridessetInput
, to allow easy access to the input, in case it is anImageInputStream
.- Overrides:
setInput
in classImageReaderBase
- Parameters:
input
- theImageInputStream
or otherObject
to use for future decoding.seekForwardOnly
- iftrue
, images and metadata may only be read in ascending order from this input source.ignoreMetadata
- iftrue
, metadata may be ignored during reads.- See Also:
-
init
- Throws:
IOException
-
initReader
- Throws:
IOException
-
initReaderListeners
private void initReaderListeners() -
init
- Throws:
IOException
-
initCatalog
- Throws:
IOException
-
getNumImages
Description copied from class:ImageReaderBase
Default implementation that always returns1
.- Overrides:
getNumImages
in classImageReaderBase
- Parameters:
allowSearch
- ignored, unless overridden- Returns:
1
, unless overridden- Throws:
IOException
- never, unless overridden
-
getWidth
- Specified by:
getWidth
in classImageReader
- Throws:
IOException
-
getHeight
- Specified by:
getHeight
in classImageReader
- Throws:
IOException
-
getImageTypes
- Specified by:
getImageTypes
in classImageReader
- Throws:
IOException
-
isPresent
-
main
- Throws:
IOException
-
createWindow
-
addImage
private static void addImage(Container pParent, ImageReader pReader, int pImageNo, String pName) throws IOException - Throws:
IOException
-