|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectImageWriter
SpatialImageWriter
StreamImageWriter
public abstract class StreamImageWriter
Base class for image writers that expect an OutputStream or channel output. This class
provides a getOutputStream() method, which return the output as
an OutputStream for convenience.
Different kinds of outputs are automatically handled. The default implementation handles all the following types:
Note theString,File,URI,URL,URLConnection,OutputStream,ImageOutputStream,WritableByteChannel.
TextImageWriter subclass can go one step further by wrapping the
InputStream into a BufferedWriter using some character encoding.
StreamImageReader
| coverage/geotk-coverageio (download) | View source code for this class |
| Nested Class Summary | |
|---|---|
protected static class |
StreamImageWriter.Spi
Service provider interface (SPI) for StreamImageWriters. |
| Field Summary | |
|---|---|
protected Closeable |
closeOnReset
The stream to close on setOutput(.Object), ImageWriter.reset()
or SpatialImageWriter.dispose() method invocation. |
| Fields inherited from class ImageWriter |
|---|
availableLocales, locale, originatingProvider, output, progressListeners, warningListeners, warningLocales |
| Fields inherited from interface WarningProducer |
|---|
LOGGER |
| Constructor Summary | |
|---|---|
protected |
StreamImageWriter(StreamImageWriter.Spi provider)
Constructs a new image writer. |
| Method Summary | |
|---|---|
protected void |
close()
Closes the output stream created by getOutputStream(). |
protected void |
finalize()
Invokes the close() method when this writer is garbage-collected. |
protected OutputStream |
getOutputStream()
Returns the output as an output stream object. |
void |
setOutput(Object output)
Sets the output source to use. |
| Methods inherited from class Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface Localized |
|---|
getLocale |
| Field Detail |
|---|
protected Closeable closeOnReset
setOutput(.Object), ImageWriter.reset()
or SpatialImageWriter.dispose() method invocation. This stream is typically an
output stream or a writer
created by getOutputStream() or similar methods in subclasses.
This field is never equal to the user-specified output, since the
usual ImageWriter contract is to not close the
user-provided stream. It is set to a non-null value only if a stream has been created
from an other user object like File or URL.
getOutputStream(),
TextImageWriter.getWriter(ImageWriteParam),
close()| Constructor Detail |
|---|
protected StreamImageWriter(StreamImageWriter.Spi provider)
provider - The ImageWriterSpi that is constructing this object, or null.| Method Detail |
|---|
public void setOutput(Object output)
String, File,
URI, URL, URLConnection, OutputStream, ImageOutputStream
or WritableByteChannel.
If the given output is null, then any currently set output source will be
removed.
setOutput in class SpatialImageWriteroutput - The output object to use for future writing.ImageWriter.getOutput(),
getOutputStream()
protected OutputStream getOutputStream()
throws IllegalStateException,
IOException
File, URI,
URL, URLConnection, ImageOutputStream or WritableByteChannel
outputs.
This method creates a new output stream only when first invoked.
All subsequent calls will returns the same instance. Consequently, the returned stream
should never be closed by the caller. It may be closed automatically
when setOutput(java.lang.Object), ImageWriter.reset() or SpatialImageWriter.dispose() methods are invoked.
ImageWriter.getOutput() as an OutputStream. This output stream is usually
not buffered.
IllegalStateException - if the output is not set.
IOException - If the output stream can't be created for an other reason.ImageWriter.getOutput(),
TextImageWriter.getWriter(ImageWriteParam)
protected void close()
throws IOException
getOutputStream(). This method does nothing
if the output stream is the output instance given by the user rather
than a stream created by this class from a File or URL output.
This method is invoked automatically by setOutput(Object), ImageWriter.reset(),
SpatialImageWriter.dispose() or finalize() methods and doesn't need to be invoked explicitly.
It has protected access only in order to allow overriding by subclasses.
IOException - if an error occurred while closing the stream.closeOnReset
protected void finalize()
throws Throwable
close() method when this writer is garbage-collected.
Note that this will actually close the stream only if it has been created
by this writer, rather than supplied by the user.
finalize in class ObjectThrowable
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||