|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.imageio.spi.IIOServiceProvider
javax.imageio.spi.ImageReaderWriterSpi
javax.imageio.spi.ImageReaderSpi
org.geotools.image.io.StreamImageReader.Spi
org.geotools.image.io.text.TextImageReader.Spi
public abstract static class TextImageReader.Spi
Service provider interface (SPI) for TextImageReader
s. This
SPI provides a convenient way to control the TextImageReader
character encoding: the charset
field. For example, many
Spi
subclasses will put the following line in their
constructor:
charset
= Charset.forName("ISO-LATIN-1"); // ISO Latin Alphabet No. 1 (ISO-8859-1)
Field Summary | |
---|---|
protected java.nio.charset.Charset |
charset
Character encoding, or null for the default. |
protected java.util.Locale |
locale
The locale for numbers or dates parsing. |
protected double |
padValue
The pad value, or Double.NaN if none. |
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 | |
---|---|
TextImageReader.Spi()
Constructs a quasi-blank TextImageReader.Spi . |
Method Summary | |
---|---|
boolean |
canDecodeInput(java.lang.Object source)
Returns true if the supplied source object appears to be of the format
supported by this reader. |
protected boolean |
canDecodeInput(java.lang.Object source,
int readAheadLimit)
Returns true if the supplied source object appears to be of the format
supported by this reader. |
protected boolean |
isValidContent(double[][] rows)
Returns true if the content of the first few rows seems valid, or false
otherwise. |
Methods inherited from class javax.imageio.spi.ImageReaderSpi |
---|
createReaderInstance, 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 |
---|
getDescription, getVendorName, getVersion, onDeregistration, onRegistration |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.nio.charset.Charset charset
null
for the default. This field is initially
null
. A value shall be set by subclasses if the files to be decoded
use some specific character encoding.
TextImageReader.getCharset(java.io.InputStream)
protected java.util.Locale locale
Locale.US
means that
numbers are expected to use dot as decimal separator. This field is initially
null
, which means that default locale should be used.
TextImageReader.getLineFormat(int)
,
TextRecordImageReader#parseLine
protected double padValue
Double.NaN
if none. Every occurences of pixel value equals
to this pad value will be replaced by Double.NaN
during read operation. Note
that this replacement doesn't apply to non-pixel values (for example x,
y coordinates in some file format).
TextImageReader.getPadValue(int)
,
TextRecordImageReader#parseLine
Constructor Detail |
---|
public TextImageReader.Spi()
TextImageReader.Spi
. It is up to the subclass to
initialize instance variables in order to provide working versions of all methods.
This constructor provides the following defaults:
ImageReaderSpi.inputTypes
= {File
, URL
, URLConnection
,
Reader
, InputStream
, ImageInputStream
, String
}ImageReaderWriterSpi.suffixes
= {"txt"
, "asc"
, "dat"
}
(lowercases and uppercases)padValue
= Double.NaN
Method Detail |
---|
public boolean canDecodeInput(java.lang.Object source) throws java.io.IOException
true
if the supplied source object appears to be of the format
supported by this reader. The default implementation tries to parse the first
few lines up to 1024 characters.
canDecodeInput
in class javax.imageio.spi.ImageReaderSpi
source
- The object (typically an ImageInputStream
) to be decoded.
true
if the source seems readable.
java.io.IOException
- If an error occured during reading.protected boolean canDecodeInput(java.lang.Object source, int readAheadLimit) throws java.io.IOException
true
if the supplied source object appears to be of the format
supported by this reader. The default implementation tries to parse the first
few lines up to the specified number of characters.
source
- The object (typically an ImageInputStream
) to be decoded.readAheadLimit
- Maximum number of characters to read. If this amount is reached
but this method still unable to make a choice, then it conservatively returns
false
.
true
if the source seems readable.
java.io.IOException
- If an error occured during reading.protected boolean isValidContent(double[][] rows)
true
if the content of the first few rows seems valid, or false
otherwise. The number of rows depends on the row length and the readAheadLimit
argument given to canDecodeInput
.
The default implementation returns true
if there is at least one row
and every row have the same number of columns.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |