Interface Encoder
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
GIFEncoder
,JPEGEncoder
,PNGEncoder
,TIFFEncoder
Image encoder.
N.B.: Implementations should not obtain encoding options from the
application configuration
.
Instead they should obtain them from the encoding
options
, which will be pre-populated with all options that are prefixed
with Encode.OPTION_PREFIX
. Ergo, all option keys used by encoders
should start with that prefix.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Releases all resources.default void
encode
(BufferedImageSequence sequence, OutputStream outputStream) Encodes the given image sequence to the given stream.void
encode
(RenderedImage image, OutputStream outputStream) Encodes the given image to the given stream.default void
Implementations that make use of the Foreign Function & Memory API should do their native work in this instance.void
Implementations should respect the settings of this instance, including itsMetadata.getXMP()
XMP metadata}, which they should try to embed, and any relevantencoding options
.
-
Method Details
-
close
void close()Releases all resources. Must be called when an instance is no longer needed.- Specified by:
close
in interfaceAutoCloseable
-
getSupportedFormats
- Returns:
- All formats supported by the instance. Note that the
implementation must create the instances from scratch and
not obtain them from the
format registry
, which may be empty at the time this method is invoked.
-
setArena
Implementations that make use of the Foreign Function & Memory API should do their native work in this instance. They should not close it.
The default implementation does nothing.
- Parameters:
arena
- Arena in which to allocate foreign memory.
-
setEncode
Implementations should respect the settings of this instance, including its
Metadata.getXMP()
XMP metadata}, which they should try to embed, and any relevantencoding options
.N.B.:
Option keys
must conform to the syntax described in the documentation ofEncode.setOption(String, Object)
.- Parameters:
encode
- Instance specifying encoding parameters.
-
encode
Encodes the given image to the given stream.- Parameters:
image
- Image to write.outputStream
- Stream to write the image to, which will not be closed.- Throws:
IOException
-
encode
Encodes the given image sequence to the given stream.
The default implementation throws
UnsupportedOperationException
.- Parameters:
sequence
- Image sequence to write.outputStream
- Stream to write the image to, which will not be closed.- Throws:
UnsupportedOperationException
- if the implementation does not support sequences.IOException
-