org.geotoolkit.image.io.plugin
Class RawImageReader.Spi

Object
  extended by IIOServiceProvider
      extended by ImageReaderWriterSpi
          extended by ImageReaderSpi
              extended by SpatialImageReader.Spi
                  extended by RawImageReader.Spi
All Implemented Interfaces:
RegisterableService, SystemOverride
Enclosing class:
RawImageReader

public static class RawImageReader.Spi
extends SpatialImageReader.Spi
implements SystemOverride

Service provider interface (SPI) for RawImageReaders. This SPI provides necessary implementation for creating default RawImageReader instances.

The default constructor initializes the fields to the values listed below. Users wanting different values should create a subclass of Spi and set the desired values in their constructor.

FieldValue
 ImageReaderWriterSpi.names   "raw" 
 ImageReaderWriterSpi.MIMETypes   "image/x-raw" 
 ImageReaderWriterSpi.pluginClassName   "org.geotoolkit.image.io.plugin.RawImageReader" 
 IIOServiceProvider.vendorName   "Geotoolkit.org" 
 IIOServiceProvider.version   Version.GEOTOOLKIT 

By default, this provider register itself after the provider supplied by the Image I/O extension for JAI, because the later supports a wider range of sample models. See onRegistration for more information.

Since:
3.07 (derived from 2.0)
Version:
3.07
Author:
Martin Desruisseaux (Geomatys)
Module:
coverage/geotk-coverageio (download)    View source code for this class

Field Summary
 
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
 
Fields inherited from interface SystemOverride
KEY_ALLOW_OVERRIDE
 
Constructor Summary
RawImageReader.Spi()
          Constructs a default RawImageReader.Spi.
 
Method Summary
 boolean canDecodeInput(Object source)
          Returns true if the given source is an instance of RawImageInputStream and is compatible with the restriction documented in RawImageReader javadoc.
 ImageReader createReaderInstance(Object extension)
          Returns an instance of the ImageReader implementation associated with this service provider.
 String getDescription(Locale locale)
          Returns a brief, human-readable description of this service provider and its associated implementation.
 void onRegistration(ServiceRegistry registry, Class<?> category)
          Invoked when this Service Provider is registered.
 
Methods inherited from class SpatialImageReader.Spi
getImageMetadataFormat, getStreamMetadataFormat
 
Methods inherited from class ImageReaderSpi
createReaderInstance, getImageWriterSpiNames, getInputTypes, isOwnReader
 
Methods inherited from class ImageReaderWriterSpi
getExtraImageMetadataFormatNames, getExtraStreamMetadataFormatNames, getFileSuffixes, getFormatNames, getMIMETypes, getNativeImageMetadataFormatName, getNativeStreamMetadataFormatName, getPluginClassName, isStandardImageMetadataFormatSupported, isStandardStreamMetadataFormatSupported
 
Methods inherited from class IIOServiceProvider
getVendorName, getVersion, onDeregistration
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RawImageReader.Spi

public RawImageReader.Spi()
Constructs a default RawImageReader.Spi. The fields are initialized as documented in the class javadoc. Subclasses can modify those values if desired.

For efficiency reasons, the fields are initialized to shared arrays. Subclasses can assign new arrays, but should not modify the default array content.

Method Detail

getDescription

public String getDescription(Locale locale)
Returns a brief, human-readable description of this service provider and its associated implementation. The resulting string should be localized for the supplied locale, if possible.

Specified by:
getDescription in class IIOServiceProvider
Parameters:
locale - A Locale for which the return value should be localized.
Returns:
A String containing a description of this service provider.

canDecodeInput

public boolean canDecodeInput(Object source)
                       throws IOException
Returns true if the given source is an instance of RawImageInputStream and is compatible with the restriction documented in RawImageReader javadoc.

Specified by:
canDecodeInput in class ImageReaderSpi
Parameters:
source - The input source to be decoded.
Returns:
true if the given source can be used by RawImageReader.
Throws:
IOException - if an I/O error occurs while reading the stream.

createReaderInstance

public ImageReader createReaderInstance(Object extension)
                                 throws IOException
Returns an instance of the ImageReader implementation associated with this service provider.

Specified by:
createReaderInstance in class ImageReaderSpi
Parameters:
extension - An optional extension object, which may be null.
Returns:
An image reader instance.
Throws:
IOException - if the attempt to instantiate the reader fails.

onRegistration

public void onRegistration(ServiceRegistry registry,
                           Class<?> category)
Invoked when this Service Provider is registered. By default, this method sets the ordering of this RawImageReader.Spi after the one provided in Image I/O extension for JAI. This behavior can be changed by setting the "geotk.system.override" system property explicitly to true.

Note that the Geotk RAW image reader will be selected only if the source given to the canDecodeInput(Object) method is compliant with the restrictions documented in the javadoc, otherwise the standard RAW image reader will be selected instead.

Specified by:
onRegistration in interface RegisterableService
Overrides:
onRegistration in class IIOServiceProvider
Parameters:
registry - The registry where is service is registered.
category - The category for which this service is registered.


Copyright © 2009-2012 Geotoolkit.org. All Rights Reserved.