org.geotools.image.io
Class TextRecordImageReader.Spi

java.lang.Object
  extended byjavax.imageio.spi.IIOServiceProvider
      extended byjavax.imageio.spi.ImageReaderWriterSpi
          extended byjavax.imageio.spi.ImageReaderSpi
              extended byorg.geotools.image.io.TextImageReader.Spi
                  extended byorg.geotools.image.io.TextRecordImageReader.Spi
All Implemented Interfaces:
javax.imageio.spi.RegisterableService
Enclosing class:
TextRecordImageReader

public static class TextRecordImageReader.Spi
extends TextImageReader.Spi

Service provider interface (SPI) for TextRecordImageReaders. This SPI provides all necessary implementations for creating default TextRecordImageReader. Subclasses only have to set some fields at construction time, e.g.:

 public final class CLSImageReaderSpi extends TextRecordImageReader.Spi
 {
     public CLSImageReaderSpi()
     {
         super("CLS", "text/x-grid-CLS");
         vendorName = "Institut de Recherche pour le D?veloppement";
         version    = "1.0";
         locale     = Locale.US;
         charset    = Charset.forName("ISO-LATIN-1");
         padValue   = 9999;
     }
 }
 
(Note: fields and are only informatives). There is no need to override any method in this example. However, developers can gain more control by creating subclasses of TextRecordImageReader and and overriding some of their methods.

Version:
1.0
Author:
Martin Desruisseaux

Field Summary
protected  float gridTolerance
          A tolerance factor during decoding, between 0 and 1.
 
Fields inherited from class org.geotools.image.io.TextImageReader.Spi
charset, locale, padValue
 
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
TextRecordImageReader.Spi()
          Construct a new SPI with name "gridded records" and MIME type "text/x-grid".
TextRecordImageReader.Spi(java.lang.String name, java.lang.String mime)
          Construct a new SPI for TextRecordImageReader.
TextRecordImageReader.Spi(java.lang.String name, java.lang.String mime, int xColumn, int yColumn)
          Construct a new SPI for TextRecordImageReader.
 
Method Summary
protected  java.lang.Boolean canDecodeLine(java.lang.String line)
          V?rifie si la ligne sp?cifi?e peut ?tre d?cod?e.
 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 org.geotools.image.io.TextImageReader.Spi
canDecodeInput, canDecodeInput
 
Methods inherited from class javax.imageio.spi.ImageReaderSpi
createReaderInstance, 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

gridTolerance

protected float gridTolerance
A tolerance factor during decoding, between 0 and 1. During decoding, the image reader compute cell's width and height (i.e. the smallest non-null difference between ordinates in a given column: x for cell's width and y for cell's height). Then, it checks if every coordinate points fall on a grid having this cell's size. If a point depart from more than gridTolerance percent of cell's width or height, an exception is thrown.

should be a small number like or . The later is more tolerant than the former.

Constructor Detail

TextRecordImageReader.Spi

public TextRecordImageReader.Spi()
Construct a new SPI with name "gridded records" and MIME type "text/x-grid".


TextRecordImageReader.Spi

public TextRecordImageReader.Spi(java.lang.String name,
                                 java.lang.String mime)
Construct a new SPI for TextRecordImageReader. x and y columns are assumed to be in column #0 and 1 respectively. Others parameters are initialized as in superclass constructor.

Parameters:
name - Format name, or to let ImageReaderWriterSpi.names unset.
mime - MIME type, or to let ImageReaderWriterSpi.MIMETypes unset.

TextRecordImageReader.Spi

public TextRecordImageReader.Spi(java.lang.String name,
                                 java.lang.String mime,
                                 int xColumn,
                                 int yColumn)
Construct a new SPI for TextRecordImageReader.

Parameters:
name - Format name, or to let ImageReaderWriterSpi.names unset.
mime - MIME type, or to let ImageReaderWriterSpi.MIMETypes unset.
xColumn - 0-based column number for x values.
yColumn - 0-based column number for y values.
Method Detail

getDescription

public java.lang.String getDescription(java.util.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.

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

canDecodeLine

protected java.lang.Boolean canDecodeLine(java.lang.String line)
V?rifie si la ligne sp?cifi?e peut ?tre d?cod?e.

Overrides:
canDecodeLine in class TextImageReader.Spi
Parameters:
line - Une des premi?res lignes du flot ? lire.
Returns:
Boolean.TRUE si la ligne peut ?tre d?cod?e, Boolean.FALSE si elle ne peut pas ?tre d?cod?e ou si on ne sait pas. Dans ce dernier cas, cette m?thode sera appel?e une nouvelle fois avec la ligne suivante.

createReaderInstance

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

Parameters:
extension - An optional extension object, which may be null.
Returns:
An image reader instance.
Throws:
java.io.IOException - if the attempt to instantiate the reader fails.


Copyright © GeoTools. All Rights Reserved.