|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.imageio.ImageWriter
org.geotools.image.io.GeographicImageWriter
org.geotools.image.io.StreamImageWriter
public abstract class StreamImageWriter
Base class for simple image encoders. This class provides a getOutputStream()
method,
which returns the output as an OutputStream
for convenience.
Different kinds of output like File or URL are automatically
handled.
Nested Class Summary | |
---|---|
static class |
StreamImageWriter.Spi
Service provider interface (SPI) for StreamImageWriter s. |
Field Summary | |
---|---|
protected java.io.Closeable |
closeOnReset
The stream to close on setOutput(java.lang.Object) , reset() or
dispose() method invocation. |
Fields inherited from class javax.imageio.ImageWriter |
---|
availableLocales, locale, originatingProvider, output, progressListeners, warningListeners, warningLocales |
Constructor Summary | |
---|---|
protected |
StreamImageWriter(javax.imageio.spi.ImageWriterSpi provider)
Constructs a new image writer. |
Method Summary | |
---|---|
protected void |
close()
Closes the output stream created by getOutputStream() . |
void |
dispose()
Allows any resources held by this writer to be released. |
protected void |
finalize()
Closes the streams. |
protected java.io.OutputStream |
getOutputStream()
Returns the output as an output stream object. |
void |
reset()
Restores the StreamImageWriter to its initial state. |
void |
setOutput(java.lang.Object output)
Sets the output source to use. |
Methods inherited from class org.geotools.image.io.GeographicImageWriter |
---|
canWriteRasters, computeSize, convertImageMetadata, convertStreamMetadata, createRectIter, getDefaultImageMetadata, getDefaultStreamMetadata, processImageComplete, processImageStarted, processThumbnailComplete, processThumbnailStarted, processWarningOccurred, processWarningOccurred, warningOccurred |
Methods inherited from class javax.imageio.ImageWriter |
---|
abort, abortRequested, addIIOWriteProgressListener, addIIOWriteWarningListener, canInsertEmpty, canInsertImage, canRemoveImage, canReplaceImageMetadata, canReplacePixels, canReplaceStreamMetadata, canWriteEmpty, canWriteSequence, clearAbortRequest, endInsertEmpty, endReplacePixels, endWriteEmpty, endWriteSequence, getAvailableLocales, getDefaultWriteParam, getLocale, getNumThumbnailsSupported, getOriginatingProvider, getOutput, getPreferredThumbnailSizes, prepareInsertEmpty, prepareReplacePixels, prepareWriteEmpty, prepareWriteSequence, processImageProgress, processImageStarted, processThumbnailProgress, processThumbnailStarted, processWarningOccurred, processWarningOccurred, processWriteAborted, removeAllIIOWriteProgressListeners, removeAllIIOWriteWarningListeners, removeIIOWriteProgressListener, removeIIOWriteWarningListener, removeImage, replaceImageMetadata, replacePixels, replacePixels, replaceStreamMetadata, setLocale, write, write, write, writeInsert, writeToSequence |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.io.Closeable closeOnReset
setOutput(java.lang.Object)
, reset()
or
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 equals 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(javax.imageio.ImageWriteParam)
,
close()
Constructor Detail |
---|
protected StreamImageWriter(javax.imageio.spi.ImageWriterSpi provider)
provider
- The ImageWriterSpi
that is invoking this constructor,
or null
if none.Method Detail |
---|
public void setOutput(java.lang.Object output)
File
, URL
, Writer
(for ASCII data), OutputStream
or
ImageOutputStream
. If output
is null
, then any currently
set output source will be removed.
setOutput
in class GeographicImageWriter
output
- The output object to use for future writing.ImageWriter.getOutput()
,
getOutputStream()
protected java.io.OutputStream getOutputStream() throws java.lang.IllegalStateException, java.io.IOException
File
, URL
,
URLConnection
or ImageOutputStream
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)
, reset()
or dispose()
methods are invoked.
ImageWriter.getOutput()
as an OutputStream
. This output stream is usually
not buffered.
java.lang.IllegalStateException
- if the output is not set.
java.io.IOException
- If the output stream can't be created for an other reason.ImageWriter.getOutput()
,
TextImageWriter.getWriter(javax.imageio.ImageWriteParam)
protected void close() throws java.io.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(java.lang.Object)
, reset()
, dispose()
or finalize()
methods and doesn't need to be invoked explicitly. It has protected
access only in order to allow overriding by subclasses.
java.io.IOException
- if an error occured while closing the stream.closeOnReset
public void reset()
StreamImageWriter
to its initial state. If an output stream were
created by a previous call to getOutputStream()
, it will be closed before to reset this writer.
reset
in class javax.imageio.ImageWriter
public void dispose()
getOutputStream()
, it will be closed
before to dispose this writer.
dispose
in class javax.imageio.ImageWriter
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |