it.geosolutions.imageio.gdalframework
Class GDALImageReaderSpi
Object
IIOServiceProvider
ImageReaderWriterSpi
ImageReaderSpi
GDALImageReaderSpi
- All Implemented Interfaces:
- RegisterableService
public abstract class GDALImageReaderSpi
- extends ImageReaderSpi
The abstract service provider interface (SPI) for GDALImageReader
s.
- Author:
- Daniele Romagnoli, GeoSolutions., Simone Giannecchini, GeoSolutions.
Fields inherited from class ImageReaderSpi |
inputTypes, STANDARD_INPUT_TYPE, writerSpiNames |
Fields inherited from class ImageReaderWriterSpi |
extraImageMetadataFormatClassNames, extraImageMetadataFormatNames, extraStreamMetadataFormatClassNames, extraStreamMetadataFormatNames, MIMETypes, names, nativeImageMetadataFormatClassName, nativeImageMetadataFormatName, nativeStreamMetadataFormatClassName, nativeStreamMetadataFormatName, pluginClassName, suffixes, supportsStandardImageMetadataFormat, supportsStandardStreamMetadataFormat |
Fields inherited from class IIOServiceProvider |
vendorName, version |
Constructor Summary |
GDALImageReaderSpi(String vendorName,
String version,
String[] names,
String[] suffixes,
String[] MIMETypes,
String readerClassName,
Class<?>[] inputTypes,
String[] writerSpiNames,
boolean supportsStandardStreamMetadataFormat,
String nativeStreamMetadataFormatName,
String nativeStreamMetadataFormatClassName,
String[] extraStreamMetadataFormatNames,
String[] extraStreamMetadataFormatClassNames,
boolean supportsStandardImageMetadataFormat,
String nativeImageMetadataFormatName,
String nativeImageMetadataFormatClassName,
String[] extraImageMetadataFormatNames,
String[] extraImageMetadataFormatClassNames,
Collection<String> supportedFormats)
|
Method Summary |
boolean |
canDecodeInput(Object input)
Checks if the provided input can be decoded by the specific SPI. |
List<String> |
getSupportedFormats()
Methods returning the formats which are supported by a plugin. |
boolean |
isAvailable()
This method tells us if this driver is available or not. |
protected boolean |
isDecodable(Dataset dataset)
Checks if the provided Dataset was opened by a Driver supporting the same
formats which are supported by the specific ImageReaderSpi. |
void |
onRegistration(ServiceRegistry registry,
Class<?> category)
Allows to deregister GDAL based spi in case GDAL libraries are
unavailable. |
Methods inherited from class ImageReaderSpi |
createReaderInstance, createReaderInstance, getImageWriterSpiNames, getInputTypes, isOwnReader |
Methods inherited from class ImageReaderWriterSpi |
getExtraImageMetadataFormatNames, getExtraStreamMetadataFormatNames, getFileSuffixes, getFormatNames, getImageMetadataFormat, getMIMETypes, getNativeImageMetadataFormatName, getNativeStreamMetadataFormatName, getPluginClassName, getStreamMetadataFormat, isStandardImageMetadataFormatSupported, isStandardStreamMetadataFormatSupported |
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 |
GDALImageReaderSpi
public GDALImageReaderSpi(String vendorName,
String version,
String[] names,
String[] suffixes,
String[] MIMETypes,
String readerClassName,
Class<?>[] inputTypes,
String[] writerSpiNames,
boolean supportsStandardStreamMetadataFormat,
String nativeStreamMetadataFormatName,
String nativeStreamMetadataFormatClassName,
String[] extraStreamMetadataFormatNames,
String[] extraStreamMetadataFormatClassNames,
boolean supportsStandardImageMetadataFormat,
String nativeImageMetadataFormatName,
String nativeImageMetadataFormatClassName,
String[] extraImageMetadataFormatNames,
String[] extraImageMetadataFormatClassNames,
Collection<String> supportedFormats)
getSupportedFormats
public List<String> getSupportedFormats()
- Methods returning the formats which are supported by a plugin.
The right value to be returned may be found using the GDAL command:
gdalinfo --formats
which lists all the supported formats.
As an instance, the result of this command may be:
VRT (rw+): Virtual Raster GTiff (rw+): GeoTIFF NITF (rw+): National
Imagery Transmission Format HFA (rw+): Erdas Imagine Images (.img)
SAR_CEOS (ro): CEOS SAR Image CEOS (ro): CEOS Image
.........................................
You need to set the String returned as the first word (as an instance:
"HFA", if you are building a plugin for the Erdas Image Images)
In some circumstances, GDAL provides more than 1 driver to manage a
specific format. As an instance, in order to handle HDF4 files, GDAL
provides two drivers: HDF4 and HDF4Image (which supports Dataset
creation). The HDF4ImageReader will be capable of manage both formats.
canDecodeInput
public boolean canDecodeInput(Object input)
throws IOException
- Checks if the provided input can be decoded by the specific SPI. When
building a new plugin, remember to implement the
getSupportedFormat abstract method.
- Specified by:
canDecodeInput
in class ImageReaderSpi
- Returns:
true
if the input can be successfully decoded.
- Throws:
IOException
isDecodable
protected boolean isDecodable(Dataset dataset)
- Checks if the provided Dataset was opened by a Driver supporting the same
formats which are supported by the specific ImageReaderSpi.
There is a trivial example: Suppose we are implementing a plugin for HDF4
format and suppose we are testing the
canDecodeInput
with
a NITF file as input. GDAL will successfully open the NITF file. However,
it will use the NITF driver instead of the HDF4 driver. Since NITF is not
supported by the HDF4ImageReaderSpi, this method will return return
false
.
- Parameters:
dataset
- The input dataset
- Returns:
true
if the format is supported.
false
otherwise.
isAvailable
public boolean isAvailable()
- This method tells us if this driver is available or not.
- Returns:
true
if the driver is available,
false
otherwise.
onRegistration
public void onRegistration(ServiceRegistry registry,
Class<?> category)
- Allows to deregister GDAL based spi in case GDAL libraries are
unavailable.
- Specified by:
onRegistration
in interface RegisterableService
- Overrides:
onRegistration
in class IIOServiceProvider
Copyright © 2006-2010 GeoSolutions. All Rights Reserved.