|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.imageio.ImageReader
org.geotools.image.io.GeographicImageReader
org.geotools.image.io.StreamImageReader
public abstract class StreamImageReader
Base class for simple image decoders. This class provides a getInputStream()
method,
which returns the input as an InputStream
for convenience.
Different kinds of input like File or URL are automatically
handled.
Nested Class Summary | |
---|---|
static class |
StreamImageReader.Spi
Service provider interface (SPI) for StreamImageReader s. |
Field Summary | |
---|---|
protected java.io.Closeable |
closeOnReset
The stream to close on setInput(...) , reset() or dispose() method invocation. |
Fields inherited from class javax.imageio.ImageReader |
---|
availableLocales, ignoreMetadata, input, locale, minIndex, originatingProvider, progressListeners, seekForwardOnly, updateListeners, warningListeners, warningLocales |
Constructor Summary | |
---|---|
protected |
StreamImageReader(javax.imageio.spi.ImageReaderSpi provider)
Constructs a new image reader. |
Method Summary | |
---|---|
protected void |
close()
Closes the input stream created by getInputStream() . |
void |
dispose()
Allows any resources held by this reader to be released. |
protected void |
finalize()
Closes the streams. |
protected java.io.InputStream |
getInputStream()
Returns the input as an input stream object. |
protected long |
getStreamLength()
Returns the stream length in bytes, or -1 if unknown. |
void |
reset()
Restores the StreamImageReader to its initial state. |
void |
setInput(java.lang.Object input,
boolean seekForwardOnly,
boolean ignoreMetadata)
Sets the input source to use. |
Methods inherited from class org.geotools.image.io.GeographicImageReader |
---|
checkBandIndex, checkImageIndex, collapseNoDataValues, flipVertically, getDefaultReadParam, getDestination, getDimension, getGeographicMetadata, getImageMetadata, getImageTypes, getNumBands, getNumImages, getRawDataType, getRawImageType, getRawImageType, getStreamMetadata, read, warningOccurred |
Methods inherited from class javax.imageio.ImageReader |
---|
abort, abortRequested, addIIOReadProgressListener, addIIOReadUpdateListener, addIIOReadWarningListener, canReadRaster, checkReadParamBandSettings, clearAbortRequest, computeRegions, getAspectRatio, getAvailableLocales, getDestination, getFormatName, getHeight, getImageMetadata, getInput, getLocale, getMinIndex, getNumThumbnails, getOriginatingProvider, getSourceRegion, getStreamMetadata, getThumbnailHeight, getThumbnailWidth, getTileGridXOffset, getTileGridYOffset, getTileHeight, getTileWidth, getWidth, 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 |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.io.Closeable closeOnReset
setInput(...)
, reset()
or dispose()
method invocation. This stream is
typically an input stream or a reader
created by getInputStream()
or similar methods in subclasses.
This field is never equals to the user-specified input, since the
usual ImageReader
contract is to not close the
user-provided stream. It is set to a non-null value only if a stream has been created
from an other user object like File
or URL
.
getInputStream()
,
TextImageReader.getReader()
,
close()
Constructor Detail |
---|
protected StreamImageReader(javax.imageio.spi.ImageReaderSpi provider)
provider
- The ImageReaderSpi
that is invoking this constructor,
or null
if none.Method Detail |
---|
public void setInput(java.lang.Object input, boolean seekForwardOnly, boolean ignoreMetadata)
File
, URL
, Reader
(for ASCII data), InputStream
or
ImageInputStream
. If input
is null
, then any currently
set input source will be removed.
setInput
in class GeographicImageReader
input
- The input 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.ImageReader.getInput()
,
getInputStream()
protected long getStreamLength() throws java.io.IOException
-1
if unknown. This method checks the
input type and invokes one of File.length()
,
ImageInputStream.length()
ou URLConnection.getContentLength()
method
accordingly.
java.io.IOException
- if an I/O error occured.protected java.io.InputStream getInputStream() throws java.lang.IllegalStateException, java.io.IOException
File
, URL
,
URLConnection
or ImageInputStream
inputs.
This method creates a new input stream only when first invoked.
All subsequent calls will returns the same instance. Consequently, the returned stream
should never be closed by the caller. It may be closed automatically
when setInput(...)
, reset()
or dispose()
methods are
invoked.
ImageReader.getInput()
as an InputStream
. This input stream is usually
not buffered.
java.lang.IllegalStateException
- if the input is not set.
java.io.IOException
- If the input stream can't be created for an other reason.ImageReader.getInput()
,
TextImageReader.getReader()
protected void close() throws java.io.IOException
getInputStream()
. This method does nothing
if the input stream is the input instance given by the user rather
than a stream created by this class from a File
or URL
input.
This method is invoked automatically by setInput(...)
, reset()
, dispose()
or finalize()
methods and
doesn't need to be invoked explicitly. It has protected access only in order to
allow overriding by subclasses.
java.io.IOException
- if an error occured while closing the stream.closeOnReset
public void reset()
StreamImageReader
to its initial state. If an input stream were
created by a previous call to getInputStream()
, it will be closed before to reset this reader.
reset
in class javax.imageio.ImageReader
public void dispose()
getInputStream()
, it will be closed
before to dispose this reader.
dispose
in class javax.imageio.ImageReader
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |