|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectIIOServiceProvider
ImageReaderWriterSpi
ImageReaderSpi
SpatialImageReader.Spi
StreamImageReader.Spi
TextImageReader.Spi
TextRecordImageReader.Spi
public static class TextRecordImageReader.Spi
Service provider interface (SPI) for TextRecordImageReaders. This SPI provides
necessary implementation for creating default TextRecordImageReader using default
locale and character set. The default constructor initializes the fields to the values
listed below:
| Field | Value |
|---|---|
ImageReaderWriterSpi.names | "records" |
ImageReaderWriterSpi.MIMETypes | "text/plain" |
ImageReaderWriterSpi.pluginClassName | "org.geotoolkit.image.io.plugin.TextRecordImageReader" |
IIOServiceProvider.vendorName | "Geotoolkit.org" |
IIOServiceProvider.version | Version.GEOTOOLKIT |
xColumn | 0 |
yColumn | 1 |
gridTolerance | May vary. |
| See super-class javadoc for remaining fields | |
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-8859-1"); // ISO-LATIN-1
padValue = -9999;
}
}
Note: fieldsThere is no need to override any method in this example. However, developers can gain more control by creating subclasses ofvendorNameandversionare only informatives.
TextRecordImageReader
and Spi.
| coverage/geotk-coverageio (download) | View source code for this class |
| 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 TextImageReader.Spi |
|---|
charset, locale, padValue |
| Fields inherited from class ImageReaderSpi |
|---|
inputTypes, STANDARD_INPUT_TYPE, writerSpiNames |
| Fields inherited from class IIOServiceProvider |
|---|
vendorName, version |
| Constructor Summary | |
|---|---|
TextRecordImageReader.Spi()
Constructs a default TextRecordImageReader.Spi. |
|
| Method Summary | |
|---|---|
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. |
protected boolean |
isValidColumnCount(int count)
Invoked by isValidColumnCount(int) for determining if the given number of
columns is valid. |
protected boolean |
isValidContent(double[][] rows)
Returns true if the content of the first few rows seems valid, or false
otherwise. |
void |
onRegistration(ServiceRegistry registry,
Class<?> category)
Invoked when this Service Provider is registered. |
| Methods inherited from class TextImageReader.Spi |
|---|
canDecodeInput, canDecodeInput, isValidHeader |
| Methods inherited from class SpatialImageReader.Spi |
|---|
getImageMetadataFormat, getStreamMetadataFormat |
| Methods inherited from class ImageReaderSpi |
|---|
createReaderInstance, getImageWriterSpiNames, getInputTypes, isOwnReader |
| Methods inherited from class IIOServiceProvider |
|---|
getVendorName, getVersion, onDeregistration |
| Methods inherited from class Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected int xColumn
TextRecordImageReader.getColumnX(int)protected int yColumn
TextRecordImageReader.getColumnY(int)protected float gridTolerance
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.
| Constructor Detail |
|---|
public TextRecordImageReader.Spi()
TextRecordImageReader.Spi. The fields are initialized as
documented in the class javadoc. Subclasses can modify
those values if desired.
For efficiency reasons, the above fields are initialized to shared arrays. Subclasses can assign new arrays, but should not modify the default array content.
| Method Detail |
|---|
public String getDescription(Locale locale)
getDescription in class IIOServiceProviderlocale - A Locale for which the return value should be localized.
public ImageReader createReaderInstance(Object extension)
throws IOException
createReaderInstance in class ImageReaderSpiextension - An optional extension object, which may be null.
IOException - if the attempt to instantiate the reader fails.protected boolean isValidContent(double[][] rows)
true if the content of the first few rows seems valid, or false
otherwise. The default implementation performs the same check than the
super-class, and additionaly checks if the (x, y) values seem
distributed on a regular grid.
isValidContent in class TextImageReader.Spirows - The first few rows.
true if the given rows seem to have a valid content.protected boolean isValidColumnCount(int count)
isValidColumnCount(int) for determining if the given number of
columns is valid. Note that this is the number of columns in the data file, not to
be confused with the image width.
isValidColumnCount in class TextImageReader.Spicount - The number of columns in the first few line of rows.
true if the given number of columns seems to be valid.
public void onRegistration(ServiceRegistry registry,
Class<?> category)
TextRecordImageReader.Spi before TextMatrixImageReader.Spi,
because the later is generic enough for claiming to be able to read records file.
onRegistration in interface RegisterableServiceonRegistration in class IIOServiceProviderregistry - The registry where is service is registered.category - The category for which this service is registered.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||