|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectImageWriter
SpatialImageWriter
StreamImageWriter
TextImageWriter
public abstract class TextImageWriter
Base class for image writers that expect a BufferedWriter output.
"Text images" are usually ASCII files where pixels values are
actually the geophysical values. This base class provides the following conveniences:
BufferedWriter from the output types, which may be a any type documented
in the super-class plus Writer.createNumberFormat(...) method which set the
number of fraction digits to
a value determined from the sample values present in the image.getCharset(ImageWriteParam) method.
TextImageReader
| coverage/geotk-coverageio (download) | View source code for this class |
| Nested Class Summary | |
|---|---|
protected static class |
TextImageWriter.Spi
Service provider interface (SPI) for TextImageWriter. |
| Field Summary |
|---|
| Fields inherited from class StreamImageWriter |
|---|
closeOnReset |
| Fields inherited from class ImageWriter |
|---|
availableLocales, locale, originatingProvider, output, progressListeners, warningListeners, warningLocales |
| Fields inherited from interface WarningProducer |
|---|
LOGGER |
| Constructor Summary | |
|---|---|
protected |
TextImageWriter(TextImageWriter.Spi provider)
Constructs a TextImageWriter. |
| Method Summary | |
|---|---|
protected void |
close()
Closes the writer created by getWriter(...). |
protected NumberFormat |
createNumberFormat(IIOImage image,
ImageWriteParam parameters)
Returns a number format to be used for formatting the sample values in the given image. |
protected Charset |
getCharset(ImageWriteParam parameters)
Returns the character set to use for encoding the string to the output stream. |
protected Locale |
getDataLocale(ImageWriteParam parameters)
Returns the locale to use for encoding values, or null for the
default. |
protected FieldPosition |
getExpectedFractionPosition(NumberFormat format)
Returns the expected position of the fraction part for numbers to be formatted using the given format. |
protected String |
getLineSeparator(ImageWriteParam parameters)
Returns the line separator to use when writing to the output stream. |
protected BufferedWriter |
getWriter(ImageWriteParam parameters)
Returns the output as a writer. |
| Methods inherited from class StreamImageWriter |
|---|
finalize, getOutputStream, setOutput |
| Methods inherited from class Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface Localized |
|---|
getLocale |
| Constructor Detail |
|---|
protected TextImageWriter(TextImageWriter.Spi provider)
TextImageWriter.
provider - The ImageWriterSpi that is constructing this object, or null.| Method Detail |
|---|
protected Locale getDataLocale(ImageWriteParam parameters)
null for the
default. The default implementation returns the
locale specified to the Spi object given to this
TextImageWriter constructor. Subclasses can override this method if they
want to specify the data locale in some other way.
Note: This locale should not be confused with ImageWriter.getLocale().
parameters - The write parameters, or null for the defaults.
TextImageWriter.Spi.locale
protected Charset getCharset(ImageWriteParam parameters)
throws IOException
Spi object given to this TextImageWriter constructor.
Subclasses can override this method if they want to specify the character encoding in
some other way.
parameters - The write parameters, or null for the defaults.
null for the platform default encoding.
IOException - If reading from the output stream failed.TextImageWriter.Spi.charsetprotected String getLineSeparator(ImageWriteParam parameters)
TextImageWriter.Spi object given to this TextImageWriter constructor. Subclasses
can override this method if they want to specify the line separator in some other way.
parameters - The write parameters, or null for the defaults.
TextImageWriter.Spi.lineSeparator
protected BufferedWriter getWriter(ImageWriteParam parameters)
throws IllegalStateException,
IOException
BufferedWriter from various output types including File, URL,
URLConnection, Writer, OutputStream and ImageOutputStream.
This method creates the new writer only when first invoked. All subsequent calls will
returns the same instance. Consequently, the returned writer should never be closed by
the caller. It may be closed automatically when setOutput(Object), reset() or dispose() methods
are invoked.
parameters - The write parameters, or null for the defaults.
ImageWriter.getOutput() usually as a BufferedWriter.
IllegalStateException - if the output is not set.
IOException - If the output stream can't be created for an other reason.ImageWriter.getOutput(),
StreamImageWriter.getOutputStream()
protected NumberFormat createNumberFormat(IIOImage image,
ImageWriteParam parameters)
image - The image or raster to be written.parameters - The write parameters, or null if the whole image will be written.
protected FieldPosition getExpectedFractionPosition(NumberFormat format)
createNumberFormat(javax.imageio.IIOImage, javax.imageio.ImageWriteParam), but the
given format doesn't need to be the instance returned by the later.
format - The format to be used for formatting numbers.
protected void close()
throws IOException
getWriter(...). This method does nothing
if the writer is the output instance given by the user rather than
a writer created by this class from a File or URL output.
close in class StreamImageWriterIOException - If an error occurred while closing the writer.StreamImageWriter.closeOnReset
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||