|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectIIOServiceProvider
ImageReaderWriterSpi
ImageReaderSpi
SpatialImageReader.Spi
ImageReaderAdapter.Spi
public abstract static class ImageReaderAdapter.Spi
Service provider interface (SPI) for ImageReaderAdapters. The constructor of this
class initializes the ImageReaderSpi.inputTypes field to types that can represent
a filename, like File or URL, rather than the usual
standard input type. The names and
MIMETypes fields are set to the values of the wrapped provider,
suffixed with the string given to the addFormatNameSuffix(String) method.
Example: An ImageReaderAdapter wrapping the "tiff" image reader
with the "-wf" suffix will have the "tiff-wf" format name and the
"image/x-tiff-wf" MIME type.
The table below summarizes the initial values. Those values can be modified by subclass constructors.
| Field | Value |
|---|---|
ImageReaderWriterSpi.names |
Same values than the main provider, suffixed by the given string. |
ImageReaderWriterSpi.suffixes |
Same values than the main provider. |
ImageReaderWriterSpi.MIMETypes |
Same values than the main provider, suffixed by the given string. |
ImageReaderAdapter.inputTypes |
String, File, URI, URL |
It is up to subclass constructors to initialize all other instance variables in order to provide working versions of every methods.
ImageWriterAdapter.Spi
| coverage/geotk-coverageio (download) | View source code for this class |
| Field Summary | |
|---|---|
protected ImageReaderSpi |
main
The provider of the readers to use for reading the pixel values. |
| Fields inherited from class ImageReaderSpi |
|---|
inputTypes, STANDARD_INPUT_TYPE, writerSpiNames |
| Fields inherited from class IIOServiceProvider |
|---|
vendorName, version |
| Constructor Summary | |
|---|---|
protected |
ImageReaderAdapter.Spi(ImageReaderSpi main)
Creates an ImageReaderAdapter.Spi wrapping the given provider. |
protected |
ImageReaderAdapter.Spi(String format)
Creates a provider which will use the given format for reading pixel values. |
| Method Summary | |
|---|---|
protected void |
addFormatNameSuffix(String suffix)
Adds the given suffix to all format names and MIME types. |
boolean |
canDecodeInput(Object source)
Returns true if the supplied source object appears to be of the format supported
by this reader. |
IIOMetadataFormat |
getImageMetadataFormat(String formatName)
Returns a description of the image metadata of the given name. |
Set<InformationType> |
getModifiedInformation(Object source)
Returns the kind of information that this wrapper will add or modify compared to the main reader. |
IIOMetadataFormat |
getStreamMetadataFormat(String formatName)
Returns a description of the stream metadata of the given name. |
void |
onRegistration(ServiceRegistry registry,
Class<?> category)
A callback that will be called exactly once after the Spi class has been
instantiated and registered in a ServiceRegistry. |
static ImageReaderSpi |
unwrap(ImageReaderSpi spi)
If the given provider is an instance of ImageReaderAdapter.Spi, returns the
underlying main provider. |
| Methods inherited from class SpatialImageReader.Spi |
|---|
addExtraMetadataFormat |
| Methods inherited from class ImageReaderSpi |
|---|
createReaderInstance, createReaderInstance, getImageWriterSpiNames, getInputTypes, isOwnReader |
| Methods inherited from class IIOServiceProvider |
|---|
getDescription, getVendorName, getVersion, onDeregistration |
| Methods inherited from class Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final ImageReaderSpi main
| Constructor Detail |
|---|
protected ImageReaderAdapter.Spi(ImageReaderSpi main)
ImageReaderAdapter.Spi wrapping the given provider. The fields are
initialized as documented in the class javadoc. It is up
to the subclass to initialize all other instance variables in order to provide working
versions of all methods.
For efficiency reasons, the inputTypes field is initialized to a shared array.
Subclasses can assign new arrays, but should not modify the default array content.
main - The provider of the readers to use for reading the pixel values.protected ImageReaderAdapter.Spi(String format)
format - The name of the provider to use for reading the pixel values.
IllegalArgumentException - If no provider is found for the given format.| Method Detail |
|---|
protected void addFormatNameSuffix(String suffix)
suffix - The suffix to append to format names and MIME types.public IIOMetadataFormat getStreamMetadataFormat(String formatName)
null.
getStreamMetadataFormat in class SpatialImageReader.SpiformatName - The desired stream metadata format.
public IIOMetadataFormat getImageMetadataFormat(String formatName)
null.
getImageMetadataFormat in class SpatialImageReader.SpiformatName - The desired image metadata format.
public boolean canDecodeInput(Object source)
throws IOException
true if the supplied source object appears to be of the format supported
by this reader. The default implementation checks if the given source is an instance of
one of the inputTypes, then delegates to the provider
given at construction time. A temporary ImageInputStream is created if needed.
canDecodeInput in class ImageReaderSpisource - The input (typically a File) to be decoded.
true if it is likely that the file can be decoded.
IOException - If an error occurred while reading the file.
public Set<InformationType> getModifiedInformation(Object source)
throws IOException
The default implementation conservatively returns all of the InformationType
enum values. Subclasses should return more accurate information when possible.
source - The input (typically a File) to be decoded.
IOException - If an error occurred while reading the file.
public void onRegistration(ServiceRegistry registry,
Class<?> category)
Spi class has been
instantiated and registered in a ServiceRegistry. The default implementation
conservatively gives precedence to the main provider, using the code
below:
The plugin order matter when an image reader is selected by file suffix, because the file suffixes of this adapter are the same than the file suffixes of the main provider by default.registry.setOrdering(category, main, this);
onRegistration in interface RegisterableServiceonRegistration in class IIOServiceProviderServiceRegistry.setOrdering(Class, Object, Object)public static ImageReaderSpi unwrap(ImageReaderSpi spi)
ImageReaderAdapter.Spi, returns the
underlying main provider. Otherwise returns the given provider unchanged.
This method is convenient when the caller is not interested in spatial metadata, in order to ensure that the cost of parsing TFW, PRJ or similar files is avoided.
spi - An image reader provider, or null.
null.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||