|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.imageio.spi.IIOServiceProvider javax.imageio.spi.ImageReaderWriterSpi javax.imageio.spi.ImageReaderSpi org.geotools.image.io.RawBinaryImageReader.Spi
Service provider interface (SPI) for RawBinaryImageReader
s.
This SPI provides all necessary implementations for creating default
RawBinaryImageReader
. Subclasses only have to set some fields
at construction time, e.g.:
(Note: fieldspublic final class CustomBinaryImageReaderSpi extends RawBinaryImageReader.Spi { public CustomBinaryImageReaderSpi() { super("MyRAW", "image/raw-perso");vendorName
= "Institut de Recherche pour le D?veloppement";version
= "1.0";dataType
=DataBuffer.TYPE_SHORT
;imageSize
= newDimension
(400,600);padValue
= 9999; } }
vendorName
and version
are only informatives).
There is no need to override any method in this example. However, developers
can gain more control by creating subclasses of RawBinaryImageReader
and Spi
and overriding some of their methods.
Field Summary | |
protected int |
dataType
The default data type. |
protected java.awt.Dimension |
imageSize
The expected image size, or null if unknow. |
protected double |
padValue
The pad value. |
Fields inherited from class javax.imageio.spi.ImageReaderSpi |
inputTypes, STANDARD_INPUT_TYPE, writerSpiNames |
Fields inherited from class javax.imageio.spi.ImageReaderWriterSpi |
extraImageMetadataFormatClassNames, extraImageMetadataFormatNames, extraStreamMetadataFormatClassNames, extraStreamMetadataFormatNames, MIMETypes, names, nativeImageMetadataFormatClassName, nativeImageMetadataFormatName, nativeStreamMetadataFormatClassName, nativeStreamMetadataFormatName, pluginClassName, suffixes, supportsStandardImageMetadataFormat, supportsStandardStreamMetadataFormat |
Fields inherited from class javax.imageio.spi.IIOServiceProvider |
vendorName, version |
Constructor Summary | |
RawBinaryImageReader.Spi()
Construct a new SPI with name "raw" and MIME type "image/raw". |
|
RawBinaryImageReader.Spi(java.lang.String name,
java.lang.String mime)
Construct a new SPI for RawBinaryImageReader . |
Method Summary | |
boolean |
canDecodeInput(java.lang.Object source)
Returns false , since "raw" format can
potentially attempt to read nearly any stream. |
javax.imageio.ImageReader |
createReaderInstance()
Returns an instance of the image reader implementation associated with this service provider. |
javax.imageio.ImageReader |
createReaderInstance(java.lang.Object extension)
Returns an instance of the ImageReader implementation associated with this service provider. |
java.lang.String |
getDescription(java.util.Locale locale)
Returns a brief, human-readable description of this service provider and its associated implementation. |
Methods inherited from class javax.imageio.spi.ImageReaderSpi |
getImageWriterSpiNames, getInputTypes, isOwnReader |
Methods inherited from class javax.imageio.spi.ImageReaderWriterSpi |
getExtraImageMetadataFormatNames, getExtraStreamMetadataFormatNames, getFileSuffixes, getFormatNames, getImageMetadataFormat, getMIMETypes, getNativeImageMetadataFormatName, getNativeStreamMetadataFormatName, getPluginClassName, getStreamMetadataFormat, isStandardImageMetadataFormatSupported, isStandardStreamMetadataFormatSupported |
Methods inherited from class javax.imageio.spi.IIOServiceProvider |
getVendorName, getVersion, onDeregistration, onRegistration |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected java.awt.Dimension imageSize
null
if unknow. Setting this
field to a non-null value allow RawBinaryImageReader.getWidth(int)
and RawBinaryImageReader.getHeight(int)
to returns this size. This
size will be compared with RawBinaryImageReadParam.getStreamImageSize()
at reading time, if such a parameter is specified. An IIOException
exception will be thrown if sizes don't match, in order to ensure consistency
with getWidth(int)
and getHeight(int)
methods.
protected double padValue
Double.NaN
.
This default value is actually redundant since NaN
is always considered as a pad value, no matter the padValue
setting. Subclasses should set a new value at construction time
if an other pad value is needed in addition to Double.NaN
.
If a single pad value is not enough, more control can be gained
by overriding RawBinaryImageReader.transform(double)
.
protected int dataType
DataBuffer
.
Common types are DataBuffer.TYPE_INT
, DataBuffer.TYPE_FLOAT
and DataBuffer.TYPE_DOUBLE
. The default value is TYPE_FLOAT
.
Constructor Detail |
public RawBinaryImageReader.Spi()
public RawBinaryImageReader.Spi(java.lang.String name, java.lang.String mime)
RawBinaryImageReader
. This
constructor initialize the following fields to default
values:
ImageReaderWriterSpi.names
):
An array of lenght 1 containing the name
argument.
ImageReaderWriterSpi.MIMETypes
):
An array of length 1 containing the mime
argument.
ImageReaderWriterSpi.suffixes
):
".raw
"
(uppercase and lowercase).ImageReaderSpi.inputTypes
):
ImageInputStream
.
name
- Format name, or null
to let ImageReaderWriterSpi.names
unset.mime
- MIME type, or null
to let ImageReaderWriterSpi.MIMETypes
unset.Method Detail |
public java.lang.String getDescription(java.util.Locale locale)
locale
- A Locale for which the return value should be localized.
public boolean canDecodeInput(java.lang.Object source) throws java.io.IOException
false
, since "raw" format can
potentially attempt to read nearly any stream.
source
- The input source to be decoded.
false
in order to avoid being
invoked in preference to a closer match.
java.io.IOException
- if an I/O error occurs while reading the stream.public javax.imageio.ImageReader createReaderInstance() throws java.io.IOException
RawBinaryImageReader
instance. Subclasses should override this
method instead of createReaderInstance(Object)
for constructing
RawBinaryImageReader
subclass.
java.io.IOException
- if the attempt to instantiate the reader fails.public javax.imageio.ImageReader createReaderInstance(java.lang.Object extension) throws java.io.IOException
extension
argument may be one of the following classes:
Dimension
for specifying the image size.createReaderInstance()
and set the resulting object's internal fields according the
extension
argument.
extension
- An optional extension object, which may be null.
java.io.IOException
- if the attempt to instantiate the reader fails.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |