org.geotools.image.io.text
Class TextRecordImageReader.Spi
java.lang.Object
javax.imageio.spi.IIOServiceProvider
javax.imageio.spi.ImageReaderWriterSpi
javax.imageio.spi.ImageReaderSpi
org.geotools.image.io.StreamImageReader.Spi
org.geotools.image.io.text.TextImageReader.Spi
org.geotools.image.io.text.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 TextRecordImageReader
s. This SPI provides
necessary implementation for creating default TextRecordImageReader
using default
locale and character set. Subclasses can set some fields at construction time in order to
tune the reader to a particular environment, e.g.:
public final class CLSImageReaderSpi extends TextRecordImageReader.Spi {
public CLSImageReaderSpi() {
names
= new String[] {"CLS"};
MIMETypes
= new String[] {"text/x-records-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 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 TextRecordImageReader
and Spi
.
- Since:
- 2.1
- Version:
- $Id: TextRecordImageReader.java 30965 2008-07-09 10:04:21Z cedricbr $
- Author:
- Martin Desruisseaux (IRD)
Field Summary |
protected float |
gridTolerance
A tolerance factor during decoding, between 0 and 1. |
protected int |
xColumn
0-based column number for x values. |
protected int |
yColumn
0-based column number for y values. |
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 |
Method Summary |
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 |
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 |
xColumn
protected int xColumn
- 0-based column number for x values. The default value is 0.
- See Also:
TextRecordImageReader.getColumnX(int)
,
TextRecordImageReader#parseLine
yColumn
protected int yColumn
- 0-based column number for y values. The default value is 1.
- See Also:
TextRecordImageReader.getColumnY(int)
,
TextRecordImageReader#parseLine
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.
gridTolerance
should be a small number like 1E-5f
or 1E-3f
. The later is more tolerant than the former.
TextRecordImageReader.Spi
public TextRecordImageReader.Spi()
- Constructs a default
TextRecordImageReader.Spi
. This constructor
provides the following defaults in addition to the defaults defined in the
super-class constructor:
ImageReaderWriterSpi.names
= "records"
ImageReaderWriterSpi.MIMETypes
= "text/x-records"
ImageReaderWriterSpi.pluginClassName
= "org.geotools.image.io.text.TextRecordImageReader"
IIOServiceProvider.vendorName
= "Geotools"
xColumn
= 0
yColumn
= 1
For efficienty reasons, the above fields are initialized to shared arrays. Subclasses
can assign new arrays, but should not modify the default array content.
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.
- Specified by:
getDescription
in class javax.imageio.spi.IIOServiceProvider
- Parameters:
locale
- A Locale for which the return value should be localized.
- Returns:
- A String containing a description of this service provider.
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.
- Specified by:
createReaderInstance
in class javax.imageio.spi.ImageReaderSpi
- 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 © 1996-2010 Geotools. All Rights Reserved.