public abstract class ImageWriter extends Object implements ImageTranscoder
ImageWriter
objects are normally instantiated by
the service provider class for the specific format. Service
provider classes are registered with the IIORegistry
,
which uses them for format recognition and presentation of
available format readers and writers.
ImageReader
,
ImageWriteParam
,
IIORegistry
,
ImageWriterSpi
| Modifier and Type | Field and Description |
|---|---|
protected Locale[] |
availableLocales
An array of
Locale s that may be used to localize
warning messages and compression setting values, or
null if localization is not supported. |
protected Locale |
locale
The current
Locale to be used for localization, or
null if none has been set. |
protected ImageWriterSpi |
originatingProvider
The
ImageWriterSpi that instantiated this object,
or null if its identity is not known or none
exists. |
protected Object |
output
The
ImageOutputStream or other Object
set by setOutput and retrieved by
getOutput . |
protected List<IIOWriteProgressListener> |
progressListeners
A
List of currently registered
IIOWriteProgressListener s, initialized by default
null , which is synonymous with an empty
List . |
protected List<IIOWriteWarningListener> |
warningListeners
A
List of currently registered
IIOWriteWarningListener s, initialized by default to
null , which is synonymous with an empty
List . |
protected List<Locale> |
warningLocales
A
List of Locale s, one for each
element of warningListeners , initialized by default
null , which is synonymous with an empty
List . |
| Modifier | Constructor and Description |
|---|---|
protected |
ImageWriter(ImageWriterSpi originatingProvider)
Constructs an
ImageWriter and sets its
originatingProvider instance variable to the
supplied value. |
| Modifier and Type | Method and Description |
|---|---|
void |
abort()
Requests that any current write operation be aborted.
|
protected boolean |
abortRequested()
Returns
true if a request to abort the current
write operation has been made since the writer was instantiated or
clearAbortRequest was called. |
void |
addIIOWriteProgressListener(IIOWriteProgressListener listener)
Adds an
IIOWriteProgressListener to the list of
registered progress listeners. |
void |
addIIOWriteWarningListener(IIOWriteWarningListener listener)
Adds an
IIOWriteWarningListener to the list of
registered warning listeners. |
boolean |
canInsertEmpty(int imageIndex)
Returns
true if the writer supports the insertion
of a new, empty image at the given index. |
boolean |
canInsertImage(int imageIndex)
Returns
true if the writer supports the insertion
of a new image at the given index. |
boolean |
canRemoveImage(int imageIndex)
Returns
true if the writer supports the removal
of an existing image at the given index. |
boolean |
canReplaceImageMetadata(int imageIndex)
Returns
true if it is possible to replace the
image metadata associated with an existing image with index
imageIndex . |
boolean |
canReplacePixels(int imageIndex)
Returns
true if the writer allows pixels of the
given image to be replaced using the replacePixels
methods. |
boolean |
canReplaceStreamMetadata()
Returns
true if it is possible to replace the
stream metadata already present in the output. |
boolean |
canWriteEmpty()
Returns
true if the writer supports the writing of
a complete image stream consisting of a single image with
undefined pixel values and associated metadata and thumbnails
to the output. |
boolean |
canWriteRasters()
Returns
true if the methods that take an
IIOImage parameter are capable of dealing with a
Raster (as opposed to RenderedImage )
source image. |
boolean |
canWriteSequence()
Returns
true if the writer is able to append an
image to an image stream that already contains header
information and possibly prior images. |
protected void |
clearAbortRequest()
Clears any previous abort request.
|
abstract IIOMetadata |
convertImageMetadata(IIOMetadata inData,
ImageTypeSpecifier imageType,
ImageWriteParam param)
Returns an
IIOMetadata object that may be used for
encoding and optionally modified using its document interfaces
or other interfaces specific to the writer plug-in that will be
used for encoding. |
abstract IIOMetadata |
convertStreamMetadata(IIOMetadata inData,
ImageWriteParam param)
Returns an
IIOMetadata object that may be used for
encoding and optionally modified using its document interfaces
or other interfaces specific to the writer plug-in that will be
used for encoding. |
void |
dispose()
Allows any resources held by this object to be released.
|
void |
endInsertEmpty()
Completes the insertion of a new image that was begun with a
prior call to
prepareInsertEmpty . |
void |
endReplacePixels()
Terminates a sequence of calls to
replacePixels . |
void |
endWriteEmpty()
Completes the writing of a new image that was begun with a
prior call to
prepareWriteEmpty . |
void |
endWriteSequence()
Completes the writing of a sequence of images begun with
prepareWriteSequence . |
Locale[] |
getAvailableLocales()
Returns an array of
Locale s that may be used to
localize warning listeners and compression settings. |
abstract IIOMetadata |
getDefaultImageMetadata(ImageTypeSpecifier imageType,
ImageWriteParam param)
Returns an
IIOMetadata object containing default
values for encoding an image of the given type. |
abstract IIOMetadata |
getDefaultStreamMetadata(ImageWriteParam param)
Returns an
IIOMetadata object containing default
values for encoding a stream of images. |
ImageWriteParam |
getDefaultWriteParam()
Returns a new
ImageWriteParam object of the
appropriate type for this file format containing default
values, that is, those values that would be used
if no ImageWriteParam object were specified. |
Locale |
getLocale()
Returns the currently set
Locale , or
null if none has been set. |
int |
getNumThumbnailsSupported(ImageTypeSpecifier imageType,
ImageWriteParam param,
IIOMetadata streamMetadata,
IIOMetadata imageMetadata)
Returns the number of thumbnails suported by the format being
written, given the image type and any additional write
parameters and metadata objects that will be used during
encoding.
|
ImageWriterSpi |
getOriginatingProvider()
Returns the
ImageWriterSpi object that created
this ImageWriter , or null if this
object was not created through the IIORegistry . |
Object |
getOutput()
Returns the
ImageOutputStream or other
Object set by the most recent call to the
setOutput method. |
Dimension[] |
getPreferredThumbnailSizes(ImageTypeSpecifier imageType,
ImageWriteParam param,
IIOMetadata streamMetadata,
IIOMetadata imageMetadata)
Returns an array of
Dimension s indicating the
legal size ranges for thumbnail images as they will be encoded
in the output file or stream. |
void |
prepareInsertEmpty(int imageIndex,
ImageTypeSpecifier imageType,
int width,
int height,
IIOMetadata imageMetadata,
List<? extends BufferedImage> thumbnails,
ImageWriteParam param)
Begins the insertion of a new image with undefined pixel values
into an existing image stream.
|
void |
prepareReplacePixels(int imageIndex,
Rectangle region)
Prepares the writer to handle a series of calls to the
replacePixels methods. |
void |
prepareWriteEmpty(IIOMetadata streamMetadata,
ImageTypeSpecifier imageType,
int width,
int height,
IIOMetadata imageMetadata,
List<? extends BufferedImage> thumbnails,
ImageWriteParam param)
Begins the writing of a complete image stream, consisting of a
single image with undefined pixel values and associated
metadata and thumbnails, to the output.
|
void |
prepareWriteSequence(IIOMetadata streamMetadata)
Prepares a stream to accept a series of subsequent
writeToSequence calls, using the provided stream
metadata object. |
protected void |
processImageComplete()
Broadcasts the completion of an image write to all registered
IIOWriteProgressListener s by calling their
imageComplete method. |
protected void |
processImageProgress(float percentageDone)
Broadcasts the current percentage of image completion to all
registered
IIOWriteProgressListener s by calling
their imageProgress method. |
protected void |
processImageStarted(int imageIndex)
Broadcasts the start of an image write to all registered
IIOWriteProgressListener s by calling their
imageStarted method. |
protected void |
processThumbnailComplete()
Broadcasts the completion of a thumbnail write to all registered
IIOWriteProgressListener s by calling their
thumbnailComplete method. |
protected void |
processThumbnailProgress(float percentageDone)
Broadcasts the current percentage of thumbnail completion to
all registered
IIOWriteProgressListener s by calling
their thumbnailProgress method. |
protected void |
processThumbnailStarted(int imageIndex,
int thumbnailIndex)
Broadcasts the start of a thumbnail write to all registered
IIOWriteProgressListener s by calling their
thumbnailStarted method. |
protected void |
processWarningOccurred(int imageIndex,
String warning)
Broadcasts a warning message to all registered
IIOWriteWarningListener s by calling their
warningOccurred method. |
protected void |
processWarningOccurred(int imageIndex,
String baseName,
String keyword)
Broadcasts a localized warning message to all registered
IIOWriteWarningListener s by calling their
warningOccurred method with a string taken
from a ResourceBundle . |
protected void |
processWriteAborted()
Broadcasts that the write has been aborted to all registered
IIOWriteProgressListener s by calling their
writeAborted method. |
void |
removeAllIIOWriteProgressListeners()
Removes all currently registered
IIOWriteProgressListener objects. |
void |
removeAllIIOWriteWarningListeners()
Removes all currently registered
IIOWriteWarningListener objects. |
void |
removeIIOWriteProgressListener(IIOWriteProgressListener listener)
Removes an
IIOWriteProgressListener from the list
of registered progress listeners. |
void |
removeIIOWriteWarningListener(IIOWriteWarningListener listener)
Removes an
IIOWriteWarningListener from the list
of registered warning listeners. |
void |
removeImage(int imageIndex)
Removes an image from the stream.
|
void |
replaceImageMetadata(int imageIndex,
IIOMetadata imageMetadata)
Replaces the image metadata associated with an existing image.
|
void |
replacePixels(Raster raster,
ImageWriteParam param)
Replaces a portion of an image already present in the output
with a portion of the given
Raster . |
void |
replacePixels(RenderedImage image,
ImageWriteParam param)
Replaces a portion of an image already present in the output
with a portion of the given image.
|
void |
replaceStreamMetadata(IIOMetadata streamMetadata)
Replaces the stream metadata in the output with new
information.
|
void |
reset()
Restores the
ImageWriter to its initial state. |
void |
setLocale(Locale locale)
Sets the current
Locale of this
ImageWriter to the given value. |
void |
setOutput(Object output)
Sets the destination to the given
ImageOutputStream or other Object . |
void |
write(IIOImage image)
Appends a complete image stream containing a single image with
default metadata and thumbnails to the output.
|
abstract void |
write(IIOMetadata streamMetadata,
IIOImage image,
ImageWriteParam param)
Appends a complete image stream containing a single image and
associated stream and image metadata and thumbnails to the
output.
|
void |
write(RenderedImage image)
Appends a complete image stream consisting of a single image
with default metadata and thumbnails to the output.
|
void |
writeInsert(int imageIndex,
IIOImage image,
ImageWriteParam param)
Inserts a new image into an existing image stream.
|
void |
writeToSequence(IIOImage image,
ImageWriteParam param)
Appends a single image and possibly associated metadata and
thumbnails, to the output.
|
protected ImageWriterSpi originatingProvider
ImageWriterSpi
that instantiated this object,
or null
if its identity is not known or none
exists. By default it is initialized to null
.protected Object output
ImageOutputStream
or other Object
set by setOutput
and retrieved by
getOutput
. By default it is initialized to
null
.protected Locale[] availableLocales
Locale
s that may be used to localize
warning messages and compression setting values, or
null
if localization is not supported. By default
it is initialized to null
.protected Locale locale
Locale
to be used for localization, or
null
if none has been set. By default it is
initialized to null
.protected List<IIOWriteWarningListener> warningListeners
List
of currently registered
IIOWriteWarningListener
s, initialized by default to
null
, which is synonymous with an empty
List
.protected List<Locale> warningLocales
List
of Locale
s, one for each
element of warningListeners
, initialized by default
null
, which is synonymous with an empty
List
.protected List<IIOWriteProgressListener> progressListeners
List
of currently registered
IIOWriteProgressListener
s, initialized by default
null
, which is synonymous with an empty
List
.protected ImageWriter(ImageWriterSpi originatingProvider)
ImageWriter
and sets its
originatingProvider
instance variable to the
supplied value.
Subclasses that make use of extensions should provide a
constructor with signature (ImageWriterSpi,
Object)
in order to retrieve the extension object. If
the extension object is unsuitable, an
IllegalArgumentException
should be thrown.
originatingProvider
- the ImageWriterSpi
that
is constructing this object, or null
.public ImageWriterSpi getOriginatingProvider()
ImageWriterSpi
object that created
this ImageWriter
, or null
if this
object was not created through the IIORegistry
.
The default implementation returns the value of the
originatingProvider
instance variable.
ImageWriterSpi
, or null
.ImageWriterSpi
public void setOutput(Object output)
ImageOutputStream
or other Object
.
The destination is assumed to be ready to accept data, and will
not be closed at the end of each write. This allows distributed
imaging applications to transmit a series of images over a
single network connection. If output
is
null
, any currently set output will be removed.
If output
is an
ImageOutputStream
, calls to the
write
, writeToSequence
, and
prepareWriteEmpty
/endWriteEmpty
methods will preserve the existing contents of the stream.
Other write methods, such as writeInsert
,
replaceStreamMetadata
,
replaceImageMetadata
, replacePixels
,
prepareInsertEmpty
/endInsertEmpty
,
and endWriteSequence
, require the full contents
of the stream to be readable and writable, and may alter any
portion of the stream.
Use of a general Object
other than an
ImageOutputStream
is intended for writers that
interact directly with an output device or imaging protocol.
The set of legal classes is advertised by the writer's service
provider's getOutputTypes
method; most writers
will return a single-element array containing only
ImageOutputStream.class
to indicate that they
accept only an ImageOutputStream
.
The default implementation sets the output
instance variable to the value of output
after
checking output
against the set of classes
advertised by the originating provider, if there is one.
output
- the ImageOutputStream
or other
Object
to use for future writing.IllegalArgumentException
- if output
is
not an instance of one of the classes returned by the
originating service provider's getOutputTypes
method.getOutput()
public Object getOutput()
ImageOutputStream
or other
Object
set by the most recent call to the
setOutput
method. If no destination has been
set, null
is returned.
The default implementation returns the value of the
output
instance variable.
Object
that was specified using
setOutput
, or null
.setOutput(java.lang.Object)
public Locale[] getAvailableLocales()
Locale
s that may be used to
localize warning listeners and compression settings. A return
value of null
indicates that localization is not
supported.
The default implementation returns a clone of the
availableLocales
instance variable if it is
non-null
, or else returns null
.
Locale
s that may be used as
arguments to setLocale
, or null
.public void setLocale(Locale locale)
Locale
of this
ImageWriter
to the given value. A value of
null
removes any previous setting, and indicates
that the writer should localize as it sees fit.
The default implementation checks locale
against the values returned by
getAvailableLocales
, and sets the
locale
instance variable if it is found. If
locale
is null
, the instance variable
is set to null
without any checking.
locale
- the desired Locale
, or
null
.IllegalArgumentException
- if locale
is
non-null
but is not one of the values returned by
getAvailableLocales
.getLocale()
public Locale getLocale()
Locale
, or
null
if none has been set.
The default implementation returns the value of the
locale
instance variable.
Locale
, or null
.setLocale(java.util.Locale)
public ImageWriteParam getDefaultWriteParam()
ImageWriteParam
object of the
appropriate type for this file format containing default
values, that is, those values that would be used
if no ImageWriteParam
object were specified. This
is useful as a starting point for tweaking just a few parameters
and otherwise leaving the default settings alone.
The default implementation constructs and returns a new
ImageWriteParam
object that does not allow tiling,
progressive encoding, or compression, and that will be
localized for the current Locale
(i.e.,
what you would get by calling new
ImageWriteParam(getLocale())
.
Individual plug-ins may return an instance of
ImageWriteParam
with additional optional features
enabled, or they may return an instance of a plug-in specific
subclass of ImageWriteParam
.
ImageWriteParam
object containing
default values.public abstract IIOMetadata getDefaultStreamMetadata(ImageWriteParam param)
IIOMetadata
object containing default
values for encoding a stream of images. The contents of the
object may be manipulated using either the XML tree structure
returned by the IIOMetadata.getAsTree
method, an
IIOMetadataController
object, or via plug-in
specific interfaces, and the resulting data supplied to one of
the write
methods that take a stream metadata
parameter.
An optional ImageWriteParam
may be supplied
for cases where it may affect the structure of the stream
metadata.
If the supplied ImageWriteParam
contains
optional setting values not supported by this writer (e.g.
progressive encoding or any format-specific settings), they
will be ignored.
Writers that do not make use of stream metadata
(e.g., writers for single-image formats) should return
null
.
param
- an ImageWriteParam
that will be used to
encode the image, or null
.IIOMetadata
object.public abstract IIOMetadata getDefaultImageMetadata(ImageTypeSpecifier imageType, ImageWriteParam param)
IIOMetadata
object containing default
values for encoding an image of the given type. The contents
of the object may be manipulated using either the XML tree
structure returned by the IIOMetadata.getAsTree
method, an IIOMetadataController
object, or via
plug-in specific interfaces, and the resulting data supplied to
one of the write
methods that take a stream
metadata parameter.
An optional ImageWriteParam
may be supplied
for cases where it may affect the structure of the image
metadata.
If the supplied ImageWriteParam
contains
optional setting values not supported by this writer (e.g.
progressive encoding or any format-specific settings), they
will be ignored.
imageType
- an ImageTypeSpecifier
indicating the
format of the image to be written later.param
- an ImageWriteParam
that will be used to
encode the image, or null
.IIOMetadata
object.public abstract IIOMetadata convertStreamMetadata(IIOMetadata inData, ImageWriteParam param)
ImageTranscoder
IIOMetadata
object that may be used for
encoding and optionally modified using its document interfaces
or other interfaces specific to the writer plug-in that will be
used for encoding.
An optional ImageWriteParam
may be supplied
for cases where it may affect the structure of the stream
metadata.
If the supplied ImageWriteParam
contains
optional setting values not understood by this writer or
transcoder, they will be ignored.
convertStreamMetadata
in interface ImageTranscoder
inData
- an IIOMetadata
object representing
stream metadata, used to initialize the state of the returned
object.param
- an ImageWriteParam
that will be used to
encode the image, or null
.IIOMetadata
object, or
null
if the plug-in does not provide metadata
encoding capabilities.public abstract IIOMetadata convertImageMetadata(IIOMetadata inData, ImageTypeSpecifier imageType, ImageWriteParam param)
ImageTranscoder
IIOMetadata
object that may be used for
encoding and optionally modified using its document interfaces
or other interfaces specific to the writer plug-in that will be
used for encoding.
An optional ImageWriteParam
may be supplied
for cases where it may affect the structure of the image
metadata.
If the supplied ImageWriteParam
contains
optional setting values not understood by this writer or
transcoder, they will be ignored.
convertImageMetadata
in interface ImageTranscoder
inData
- an IIOMetadata
object representing
image metadata, used to initialize the state of the returned
object.imageType
- an ImageTypeSpecifier
indicating
the layout and color information of the image with which the
metadata will be associated.param
- an ImageWriteParam
that will be used to
encode the image, or null
.IIOMetadata
object,
or null
if the plug-in does not provide
metadata encoding capabilities.public int getNumThumbnailsSupported(ImageTypeSpecifier imageType, ImageWriteParam param, IIOMetadata streamMetadata, IIOMetadata imageMetadata)
-1
indicates that
insufficient information is available.
An ImageWriteParam
may optionally be supplied
for cases where it may affect thumbnail handling.
If the supplied ImageWriteParam
contains
optional setting values not supported by this writer (e.g.
progressive encoding or any format-specific settings), they
will be ignored.
The default implementation returns 0.
imageType
- an ImageTypeSpecifier
indicating
the type of image to be written, or null
.param
- the ImageWriteParam
that will be used for
writing, or null
.streamMetadata
- an IIOMetadata
object that will
be used for writing, or null
.imageMetadata
- an IIOMetadata
object that will
be used for writing, or null
.-1
if insufficient
information is available.public Dimension[] getPreferredThumbnailSizes(ImageTypeSpecifier imageType, ImageWriteParam param, IIOMetadata streamMetadata, IIOMetadata imageMetadata)
Dimension
s indicating the
legal size ranges for thumbnail images as they will be encoded
in the output file or stream. This information is merely
advisory; the writer will resize any supplied thumbnails as
necessary.
The information is returned as a set of pairs; the first
element of a pair contains an (inclusive) minimum width and
height, and the second element contains an (inclusive) maximum
width and height. Together, each pair defines a valid range of
sizes. To specify a fixed size, the same width and height will
appear for both elements. A return value of null
indicates that the size is arbitrary or unknown.
An ImageWriteParam
may optionally be supplied
for cases where it may affect thumbnail handling.
If the supplied ImageWriteParam
contains
optional setting values not supported by this writer (e.g.
progressive encoding or any format-specific settings), they
will be ignored.
The default implementation returns null
.
imageType
- an ImageTypeSpecifier
indicating the
type of image to be written, or null
.param
- the ImageWriteParam
that will be used for
writing, or null
.streamMetadata
- an IIOMetadata
object that will
be used for writing, or null
.imageMetadata
- an IIOMetadata
object that will
be used for writing, or null
.Dimension
s with an even length
of at least two, or null
.public boolean canWriteRasters()
true
if the methods that take an
IIOImage
parameter are capable of dealing with a
Raster
(as opposed to RenderedImage
)
source image. If this method returns false
, then
those methods will throw an
UnsupportedOperationException
if supplied with an
IIOImage
containing a Raster
.
The default implementation returns false
.
true
if Raster
sources are
supported.public abstract void write(IIOMetadata streamMetadata, IIOImage image, ImageWriteParam param) throws IOException
ImageOutputStream
, its existing
contents prior to the current seek position are not affected,
and need not be readable or writable.
The output must have been set beforehand using the
setOutput
method.
Stream metadata may optionally be supplied; if it is
null
, default stream metadata will be used.
If canWriteRasters
returns true
,
the IIOImage
may contain a Raster
source. Otherwise, it must contain a
RenderedImage
source.
The supplied thumbnails will be resized if needed, and any thumbnails in excess of the supported number will be ignored. If the format requires additional thumbnails that are not provided, the writer should generate them internally.
An ImageWriteParam
may
optionally be supplied to control the writing process. If
param
is null
, a default write param
will be used.
If the supplied ImageWriteParam
contains
optional setting values not supported by this writer (e.g.
progressive encoding or any format-specific settings), they
will be ignored.
streamMetadata
- an IIOMetadata
object representing
stream metadata, or null
to use default values.image
- an IIOImage
object containing an
image, thumbnails, and metadata to be written.param
- an ImageWriteParam
, or
null
to use a default
ImageWriteParam
.IllegalStateException
- if the output has not
been set.UnsupportedOperationException
- if image
contains a Raster
and canWriteRasters
returns false
.IllegalArgumentException
- if image
is
null
.IOException
- if an error occurs during writing.public void write(IIOImage image) throws IOException
write(null, image, null)
.image
- an IIOImage
object containing an
image, thumbnails, and metadata to be written.IllegalStateException
- if the output has not
been set.IllegalArgumentException
- if image
is
null
.UnsupportedOperationException
- if image
contains a Raster
and canWriteRasters
returns false
.IOException
- if an error occurs during writing.public void write(RenderedImage image) throws IOException
write(null, new IIOImage(image,
null, null), null)
.image
- a RenderedImage
to be written.IllegalStateException
- if the output has not
been set.IllegalArgumentException
- if image
is
null
.IOException
- if an error occurs during writing.public boolean canWriteSequence()
true
if the writer is able to append an
image to an image stream that already contains header
information and possibly prior images.
If canWriteSequence
returns false
,
writeToSequence
and endWriteSequence
will throw an UnsupportedOperationException
.
The default implementation returns false
.
true
if images may be appended sequentially.public void prepareWriteSequence(IIOMetadata streamMetadata) throws IOException
writeToSequence
calls, using the provided stream
metadata object. The metadata will be written to the stream if
it should precede the image data. If the argument is null
,
default stream metadata is used.
If the output is an ImageOutputStream
, the existing
contents of the output prior to the current seek position are
flushed, and need not be readable or writable. If the format
requires that endWriteSequence
be able to rewind to
patch up the header information, such as for a sequence of images
in a single TIFF file, then the metadata written by this method
must remain in a writable portion of the stream. Other formats
may flush the stream after this method and after each image.
If canWriteSequence
returns false
,
this method will throw an
UnsupportedOperationException
.
The output must have been set beforehand using either
the setOutput
method.
The default implementation throws an
IllegalStateException
if the output is
null
, and otherwise throws an
UnsupportedOperationException
.
streamMetadata
- A stream metadata object, or null
.IllegalStateException
- if the output has not
been set.UnsupportedOperationException
- if
canWriteSequence
returns false
.IOException
- if an error occurs writing the stream
metadata.public void writeToSequence(IIOImage image, ImageWriteParam param) throws IOException
ImageOutputStream
, the existing contents of the
output prior to the current seek position may be flushed, and
need not be readable or writable, unless the plug-in needs to
be able to patch up the header information when
endWriteSequence
is called ( If canWriteSequence
returns false
,
this method will throw an
UnsupportedOperationException
.
The output must have been set beforehand using
the setOutput
method.
prepareWriteSequence
must have been called
beforehand, or an IllegalStateException
is thrown.
If canWriteRasters
returns true
,
the IIOImage
may contain a Raster
source. Otherwise, it must contain a
RenderedImage
source.
The supplied thumbnails will be resized if needed, and any thumbnails in excess of the supported number will be ignored. If the format requires additional thumbnails that are not provided, the writer will generate them internally.
An ImageWriteParam
may optionally be supplied
to control the writing process. If param
is
null
, a default write param will be used.
If the supplied ImageWriteParam
contains
optional setting values not supported by this writer (e.g.
progressive encoding or any format-specific settings), they
will be ignored.
The default implementation throws an
IllegalStateException
if the output is
null
, and otherwise throws an
UnsupportedOperationException
.
image
- an IIOImage
object containing an
image, thumbnails, and metadata to be written.param
- an ImageWriteParam
, or
null
to use a default
ImageWriteParam
.IllegalStateException
- if the output has not
been set, or prepareWriteSequence
has not been called.UnsupportedOperationException
- if
canWriteSequence
returns false
.IllegalArgumentException
- if image
is
null
.UnsupportedOperationException
- if image
contains a Raster
and canWriteRasters
returns false
.IOException
- if an error occurs during writing.public void endWriteSequence() throws IOException
prepareWriteSequence
. Any stream metadata that
should come at the end of the sequence of images is written out,
and any header information at the beginning of the sequence is
patched up if necessary. If the output is an
ImageOutputStream
, data through the stream metadata
at the end of the sequence are flushed and need not be readable
or writable.
If canWriteSequence
returns false
,
this method will throw an
UnsupportedOperationException
.
The default implementation throws an
IllegalStateException
if the output is
null
, and otherwise throws an
UnsupportedOperationException
.
IllegalStateException
- if the output has not
been set, or prepareWriteSequence
has not been called.UnsupportedOperationException
- if
canWriteSequence
returns false
.IOException
- if an error occurs during writing.public boolean canReplaceStreamMetadata() throws IOException
true
if it is possible to replace the
stream metadata already present in the output.
The default implementation throws an
IllegalStateException
if the output is
null
, and otherwise returns false
.
true
if replacement of stream metadata is
allowed.IllegalStateException
- if the output has not
been set.IOException
- if an I/O error occurs during the query.public void replaceStreamMetadata(IIOMetadata streamMetadata) throws IOException
ImageOutputStream
, the prior contents of the
stream are examined and possibly edited to make room for the
new data. All of the prior contents of the output must be
available for reading and writing.
If canReplaceStreamMetadata
returns
false
, an
UnsupportedOperationException
will be thrown.
The default implementation throws an
IllegalStateException
if the output is
null
, and otherwise throws an
UnsupportedOperationException
.
streamMetadata
- an IIOMetadata
object representing
stream metadata, or null
to use default values.IllegalStateException
- if the output has not
been set.UnsupportedOperationException
- if the
canReplaceStreamMetadata
returns
false
. modes do not includeIOException
- if an error occurs during writing.public boolean canReplaceImageMetadata(int imageIndex) throws IOException
true
if it is possible to replace the
image metadata associated with an existing image with index
imageIndex
. If this method returns
false
, a call to
replaceImageMetadata(imageIndex)
will throw an
UnsupportedOperationException
.
A writer that does not support any image metadata
replacement may return false
without performing
bounds checking on the index.
The default implementation throws an
IllegalStateException
if the output is
null
, and otherwise returns false
without checking the value of imageIndex
.
imageIndex
- the index of the image whose metadata is to
be replaced.true
if the image metadata of the given
image can be replaced.IllegalStateException
- if the output has not
been set.IndexOutOfBoundsException
- if the writer supports
image metadata replacement in general, but
imageIndex
is less than 0 or greater than the
largest available index.IOException
- if an I/O error occurs during the query.public void replaceImageMetadata(int imageIndex, IIOMetadata imageMetadata) throws IOException
If canReplaceImageMetadata(imageIndex)
returns
false
, an
UnsupportedOperationException
will be thrown.
The default implementation throws an
IllegalStateException
if the output is
null
, and otherwise throws an
UnsupportedOperationException
.
imageIndex
- the index of the image whose metadata is to
be replaced.imageMetadata
- an IIOMetadata
object
representing image metadata, or null
.IllegalStateException
- if the output has not been
set.UnsupportedOperationException
- if
canReplaceImageMetadata
returns
false
.IndexOutOfBoundsException
- if imageIndex
is less than 0 or greater than the largest available index.IOException
- if an error occurs during writing.public boolean canInsertImage(int imageIndex) throws IOException
true
if the writer supports the insertion
of a new image at the given index. Existing images with
indices greater than or equal to the insertion index will have
their indices increased by 1. A value for
imageIndex
of -1
may be used to
signify an index one larger than the current largest index.
A writer that does not support any image insertion may
return false
without performing bounds checking on
the index.
The default implementation throws an
IllegalStateException
if the output is
null
, and otherwise returns false
withour checking the value of imageIndex
.
imageIndex
- the index at which the image is to be
inserted.true
if an image may be inserted at the
given index.IllegalStateException
- if the output has not
been set.IndexOutOfBoundsException
- if the writer supports
image insertion in general, but imageIndex
is less
than -1 or greater than the largest available index.IOException
- if an I/O error occurs during the query.public void writeInsert(int imageIndex, IIOImage image, ImageWriteParam param) throws IOException
imageIndex
are
preserved, and their indices are each increased by 1. A value
for imageIndex
of -1 may be used to signify an
index one larger than the previous largest index; that is, it
will cause the image to be logically appended to the end of the
sequence. If the output is an ImageOutputStream
,
the entirety of the stream must be both readable and writeable.
If canInsertImage(imageIndex)
returns
false
, an
UnsupportedOperationException
will be thrown.
An ImageWriteParam
may optionally be supplied
to control the writing process. If param
is
null
, a default write param will be used.
If the supplied ImageWriteParam
contains
optional setting values not supported by this writer (e.g.
progressive encoding or any format-specific settings), they
will be ignored.
The default implementation throws an
IllegalStateException
if the output is
null
, and otherwise throws an
UnsupportedOperationException
.
imageIndex
- the index at which to write the image.image
- an IIOImage
object containing an
image, thumbnails, and metadata to be written.param
- an ImageWriteParam
, or
null
to use a default
ImageWriteParam
.IllegalStateException
- if the output has not
been set.UnsupportedOperationException
- if
canInsertImage(imageIndex)
returns false
.IllegalArgumentException
- if image
is
null
.IndexOutOfBoundsException
- if imageIndex
is less than -1 or greater than the largest available index.UnsupportedOperationException
- if image
contains a Raster
and canWriteRasters
returns false
.IOException
- if an error occurs during writing.public boolean canRemoveImage(int imageIndex) throws IOException
true
if the writer supports the removal
of an existing image at the given index. Existing images with
indices greater than the insertion index will have
their indices decreased by 1.
A writer that does not support any image removal may
return false
without performing bounds checking on
the index.
The default implementation throws an
IllegalStateException
if the output is
null
, and otherwise returns false
without checking the value of imageIndex
.
imageIndex
- the index of the image to be removed.true
if it is possible to remove the given
image.IllegalStateException
- if the output has not
been set.IndexOutOfBoundsException
- if the writer supports
image removal in general, but imageIndex
is less
than 0 or greater than the largest available index.IOException
- if an I/O error occurs during the
query.public void removeImage(int imageIndex) throws IOException
If canRemoveImage(imageIndex)
returns false,
an UnsupportedOperationException
will be thrown.
The removal may or may not cause a reduction in the actual file size.
The default implementation throws an
IllegalStateException
if the output is
null
, and otherwise throws an
UnsupportedOperationException
.
imageIndex
- the index of the image to be removed.IllegalStateException
- if the output has not
been set.UnsupportedOperationException
- if
canRemoveImage(imageIndex)
returns false
.IndexOutOfBoundsException
- if imageIndex
is less than 0 or greater than the largest available index.IOException
- if an I/O error occurs during the
removal.public boolean canWriteEmpty() throws IOException
true
if the writer supports the writing of
a complete image stream consisting of a single image with
undefined pixel values and associated metadata and thumbnails
to the output. The pixel values may be defined by future
calls to the replacePixels
methods. If the output
is an ImageOutputStream
, its existing contents
prior to the current seek position are not affected, and need
not be readable or writable.
The default implementation throws an
IllegalStateException
if the output is
null
, and otherwise returns false
.
true
if the writing of complete image
stream with contents to be defined later is supported.IllegalStateException
- if the output has not been
set.IOException
- if an I/O error occurs during the
query.public void prepareWriteEmpty(IIOMetadata streamMetadata, ImageTypeSpecifier imageType, int width, int height, IIOMetadata imageMetadata, List<? extends BufferedImage> thumbnails, ImageWriteParam param) throws IOException
replacePixels
methods. If the output is an ImageOutputStream
,
its existing contents prior to the current seek position are
not affected, and need not be readable or writable.
The writing is not complete until a call to
endWriteEmpty
occurs. Calls to
prepareReplacePixels
, replacePixels
,
and endReplacePixels
may occur between calls to
prepareWriteEmpty
and endWriteEmpty
.
However, calls to prepareWriteEmpty
cannot be
nested, and calls to prepareWriteEmpty
and
prepareInsertEmpty
may not be interspersed.
If canWriteEmpty
returns false
,
an UnsupportedOperationException
will be thrown.
An ImageWriteParam
may optionally be supplied
to control the writing process. If param
is
null
, a default write param will be used.
If the supplied ImageWriteParam
contains
optional setting values not supported by this writer (e.g.
progressive encoding or any format-specific settings), they
will be ignored.
The default implementation throws an
IllegalStateException
if the output is
null
, and otherwise throws an
UnsupportedOperationException
.
streamMetadata
- an IIOMetadata
object representing
stream metadata, or null
to use default values.imageType
- an ImageTypeSpecifier
describing
the layout of the image.width
- the width of the image.height
- the height of the image.imageMetadata
- an IIOMetadata
object
representing image metadata, or null
.thumbnails
- a List
of
BufferedImage
thumbnails for this image, or
null
.param
- an ImageWriteParam
, or
null
to use a default
ImageWriteParam
.IllegalStateException
- if the output has not
been set.UnsupportedOperationException
- if
canWriteEmpty
returns false
.IllegalStateException
- if a previous call to
prepareWriteEmpty
has been made without a
corresponding call to endWriteEmpty
.IllegalStateException
- if a previous call to
prepareInsertEmpty
has been made without a
corresponding call to endInsertEmpty
.IllegalArgumentException
- if imageType
is null
or thumbnails
contains
null
references or objects other than
BufferedImage
s.IllegalArgumentException
- if width or height are less
than 1.IOException
- if an I/O error occurs during writing.public void endWriteEmpty() throws IOException
prepareWriteEmpty
.
If canWriteEmpty()
returns false
,
an UnsupportedOperationException
will be thrown.
The default implementation throws an
IllegalStateException
if the output is
null
, and otherwise throws an
UnsupportedOperationException
.
IllegalStateException
- if the output has not
been set.UnsupportedOperationException
- if
canWriteEmpty(imageIndex)
returns
false
.IllegalStateException
- if a previous call to
prepareWriteEmpty
without a corresponding call to
endWriteEmpty
has not been made.IllegalStateException
- if a previous call to
prepareInsertEmpty
without a corresponding call to
endInsertEmpty
has been made.IllegalStateException
- if a call to
prepareReiplacePixels
has been made without a
matching call to endReplacePixels
.IOException
- if an I/O error occurs during writing.public boolean canInsertEmpty(int imageIndex) throws IOException
true
if the writer supports the insertion
of a new, empty image at the given index. The pixel values of
the image are undefined, and may be specified in pieces using
the replacePixels
methods. Existing images with
indices greater than or equal to the insertion index will have
their indices increased by 1. A value for
imageIndex
of -1
may be used to
signify an index one larger than the current largest index.
A writer that does not support insertion of empty images
may return false
without performing bounds
checking on the index.
The default implementation throws an
IllegalStateException
if the output is
null
, and otherwise returns false
without checking the value of imageIndex
.
imageIndex
- the index at which the image is to be
inserted.true
if an empty image may be inserted at
the given index.IllegalStateException
- if the output has not been
set.IndexOutOfBoundsException
- if the writer supports
empty image insertion in general, but imageIndex
is less than -1 or greater than the largest available index.IOException
- if an I/O error occurs during the
query.public void prepareInsertEmpty(int imageIndex, ImageTypeSpecifier imageType, int width, int height, IIOMetadata imageMetadata, List<? extends BufferedImage> thumbnails, ImageWriteParam param) throws IOException
imageIndex
are preserved, and their
indices are each increased by 1. A value for
imageIndex
of -1 may be used to signify an index
one larger than the previous largest index; that is, it will
cause the image to be logically appended to the end of the
sequence. If the output is an ImageOutputStream
,
the entirety of the stream must be both readable and writeable.
The image contents may be
supplied later using the replacePixels
method.
The insertion is not complete until a call to
endInsertEmpty
occurs. Calls to
prepareReplacePixels
, replacePixels
,
and endReplacePixels
may occur between calls to
prepareInsertEmpty
and
endInsertEmpty
. However, calls to
prepareInsertEmpty
cannot be nested, and calls to
prepareWriteEmpty
and
prepareInsertEmpty
may not be interspersed.
If canInsertEmpty(imageIndex)
returns
false
, an
UnsupportedOperationException
will be thrown.
An ImageWriteParam
may optionally be supplied
to control the writing process. If param
is
null
, a default write param will be used.
If the supplied ImageWriteParam
contains
optional setting values not supported by this writer (e.g.
progressive encoding or any format-specific settings), they
will be ignored.
The default implementation throws an
IllegalStateException
if the output is
null
, and otherwise throws an
UnsupportedOperationException
.
imageIndex
- the index at which to write the image.imageType
- an ImageTypeSpecifier
describing
the layout of the image.width
- the width of the image.height
- the height of the image.imageMetadata
- an IIOMetadata
object
representing image metadata, or null
.thumbnails
- a List
of
BufferedImage
thumbnails for this image, or
null
.param
- an ImageWriteParam
, or
null
to use a default
ImageWriteParam
.IllegalStateException
- if the output has not
been set.UnsupportedOperationException
- if
canInsertEmpty(imageIndex)
returns
false
.IndexOutOfBoundsException
- if imageIndex
is less than -1 or greater than the largest available index.IllegalStateException
- if a previous call to
prepareInsertEmpty
has been made without a
corresponding call to endInsertEmpty
.IllegalStateException
- if a previous call to
prepareWriteEmpty
has been made without a
corresponding call to endWriteEmpty
.IllegalArgumentException
- if imageType
is null
or thumbnails
contains
null
references or objects other than
BufferedImage
s.IllegalArgumentException
- if width or height are less
than 1.IOException
- if an I/O error occurs during writing.public void endInsertEmpty() throws IOException
prepareInsertEmpty
.
The default implementation throws an
IllegalStateException
if the output is
null
, and otherwise throws an
UnsupportedOperationException
.
IllegalStateException
- if the output has not
been set.UnsupportedOperationException
- if
canInsertEmpty(imageIndex)
returns
false
.IllegalStateException
- if a previous call to
prepareInsertEmpty
without a corresponding call to
endInsertEmpty
has not been made.IllegalStateException
- if a previous call to
prepareWriteEmpty
without a corresponding call to
endWriteEmpty
has been made.IllegalStateException
- if a call to
prepareReplacePixels
has been made without a
matching call to endReplacePixels
.IOException
- if an I/O error occurs during writing.public boolean canReplacePixels(int imageIndex) throws IOException
true
if the writer allows pixels of the
given image to be replaced using the replacePixels
methods.
A writer that does not support any pixel replacement may
return false
without performing bounds checking on
the index.
The default implementation throws an
IllegalStateException
if the output is
null
, and otherwise returns false
without checking the value of imageIndex
.
imageIndex
- the index of the image whose pixels are to be
replaced.true
if the pixels of the given
image can be replaced.IllegalStateException
- if the output has not been
set.IndexOutOfBoundsException
- if the writer supports
pixel replacement in general, but imageIndex
is
less than 0 or greater than the largest available index.IOException
- if an I/O error occurs during the query.public void prepareReplacePixels(int imageIndex, Rectangle region) throws IOException
replacePixels
methods. The affected pixel area
will be clipped against the supplied
If canReplacePixels
returns
false
, and
UnsupportedOperationException
will be thrown.
The default implementation throws an
IllegalStateException
if the output is
null
, and otherwise throws an
UnsupportedOperationException
.
imageIndex
- the index of the image whose pixels are to be
replaced.region
- a Rectangle
that will be used to clip
future pixel regions.IllegalStateException
- if the output has not
been set.UnsupportedOperationException
- if
canReplacePixels(imageIndex)
returns
false
.IndexOutOfBoundsException
- if imageIndex
is less than 0 or greater than the largest available index.IllegalStateException
- if there is a previous call to
prepareReplacePixels
without a matching call to
endReplacePixels
(i.e., nesting is not
allowed).IllegalArgumentException
- if region
is
null
or has a width or height less than 1.IOException
- if an I/O error occurs during the
preparation.public void replacePixels(RenderedImage image, ImageWriteParam param) throws IOException
The destination region is specified in the
param
argument, and will be clipped to the image
boundaries and the region supplied to
prepareReplacePixels
. At least one pixel of the
source must not be clipped, or an exception is thrown.
An ImageWriteParam
may optionally be supplied
to control the writing process. If param
is
null
, a default write param will be used.
If the supplied ImageWriteParam
contains
optional setting values not supported by this writer (e.g.
progressive encoding or any format-specific settings), they
will be ignored.
This method may only be called after a call to
prepareReplacePixels
, or else an
IllegalStateException
will be thrown.
The default implementation throws an
IllegalStateException
if the output is
null
, and otherwise throws an
UnsupportedOperationException
.
image
- a RenderedImage
containing source
pixels.param
- an ImageWriteParam
, or
null
to use a default
ImageWriteParam
.IllegalStateException
- if the output has not
been set.UnsupportedOperationException
- if
canReplacePixels(imageIndex)
returns
false
.IllegalStateException
- if there is no previous call to
prepareReplacePixels
without a matching call to
endReplacePixels
.IllegalArgumentException
- if any of the following are true:
image
is null
.
param
is null
.
image
does not match, or this
writer cannot convert it to, the existing image layout.
IOException
- if an I/O error occurs during writing.public void replacePixels(Raster raster, ImageWriteParam param) throws IOException
Raster
. The image
data must match, or be convertible to, the image layout of the
existing image.
An ImageWriteParam
may optionally be supplied
to control the writing process. If param
is
null
, a default write param will be used.
The destination region is specified in the
param
argument, and will be clipped to the image
boundaries and the region supplied to
prepareReplacePixels
. At least one pixel of the
source must not be clipped, or an exception is thrown.
If the supplied ImageWriteParam
contains
optional setting values not supported by this writer (e.g.
progressive encoding or any format-specific settings), they
will be ignored.
This method may only be called after a call to
prepareReplacePixels
, or else an
IllegalStateException
will be thrown.
The default implementation throws an
IllegalStateException
if the output is
null
, and otherwise throws an
UnsupportedOperationException
.
raster
- a Raster
containing source
pixels.param
- an ImageWriteParam
, or
null
to use a default
ImageWriteParam
.IllegalStateException
- if the output has not
been set.UnsupportedOperationException
- if
canReplacePixels(imageIndex)
returns
false
.IllegalStateException
- if there is no previous call to
prepareReplacePixels
without a matching call to
endReplacePixels
.UnsupportedOperationException
- if
canWriteRasters
returns false
.IllegalArgumentException
- if any of the following are true:
raster
is null
.
param
is null
.
raster
does not match, or this
writer cannot convert it to, the existing image layout.
IOException
- if an I/O error occurs during writing.public void endReplacePixels() throws IOException
replacePixels
.
If canReplacePixels
returns
false
, and
UnsupportedOperationException
will be thrown.
The default implementation throws an
IllegalStateException
if the output is
null
, and otherwise throws an
UnsupportedOperationException
.
IllegalStateException
- if the output has not
been set.UnsupportedOperationException
- if
canReplacePixels(imageIndex)
returns
false
.IllegalStateException
- if there is no previous call
to prepareReplacePixels
without a matching call to
endReplacePixels
.IOException
- if an I/O error occurs during writing.public void abort()
Writers should call clearAbortRequest
at the
beginning of each write operation, and poll the value of
abortRequested
regularly during the write.
protected boolean abortRequested()
true
if a request to abort the current
write operation has been made since the writer was instantiated or
clearAbortRequest
was called.true
if the current write operation should
be aborted.abort()
,
clearAbortRequest()
protected void clearAbortRequest()
abortRequested
will return
false
.abort()
,
abortRequested()
public void addIIOWriteWarningListener(IIOWriteWarningListener listener)
IIOWriteWarningListener
to the list of
registered warning listeners. If listener
is
null
, no exception will be thrown and no action
will be taken. Messages sent to the given listener will be
localized, if possible, to match the current
Locale
. If no Locale
has been set,
warning messages may be localized as the writer sees fit.listener
- an IIOWriteWarningListener
to be
registered.removeIIOWriteWarningListener(javax.imageio.event.IIOWriteWarningListener)
public void removeIIOWriteWarningListener(IIOWriteWarningListener listener)
IIOWriteWarningListener
from the list
of registered warning listeners. If the listener was not
previously registered, or if listener
is
null
, no exception will be thrown and no action
will be taken.listener
- an IIOWriteWarningListener
to be
deregistered.addIIOWriteWarningListener(javax.imageio.event.IIOWriteWarningListener)
public void removeAllIIOWriteWarningListeners()
IIOWriteWarningListener
objects.
The default implementation sets the
warningListeners
and warningLocales
instance variables to null
.
public void addIIOWriteProgressListener(IIOWriteProgressListener listener)
IIOWriteProgressListener
to the list of
registered progress listeners. If listener
is
null
, no exception will be thrown and no action
will be taken.listener
- an IIOWriteProgressListener
to be
registered.removeIIOWriteProgressListener(javax.imageio.event.IIOWriteProgressListener)
public void removeIIOWriteProgressListener(IIOWriteProgressListener listener)
IIOWriteProgressListener
from the list
of registered progress listeners. If the listener was not
previously registered, or if listener
is
null
, no exception will be thrown and no action
will be taken.listener
- an IIOWriteProgressListener
to be
deregistered.addIIOWriteProgressListener(javax.imageio.event.IIOWriteProgressListener)
public void removeAllIIOWriteProgressListeners()
IIOWriteProgressListener
objects.
The default implementation sets the
progressListeners
instance variable to
null
.
protected void processImageStarted(int imageIndex)
IIOWriteProgressListener
s by calling their
imageStarted
method. Subclasses may use this
method as a convenience.imageIndex
- the index of the image about to be written.protected void processImageProgress(float percentageDone)
IIOWriteProgressListener
s by calling
their imageProgress
method. Subclasses may use
this method as a convenience.percentageDone
- the current percentage of completion,
as a float
.protected void processImageComplete()
IIOWriteProgressListener
s by calling their
imageComplete
method. Subclasses may use this
method as a convenience.protected void processThumbnailStarted(int imageIndex, int thumbnailIndex)
IIOWriteProgressListener
s by calling their
thumbnailStarted
method. Subclasses may use this
method as a convenience.imageIndex
- the index of the image associated with the
thumbnail.thumbnailIndex
- the index of the thumbnail.protected void processThumbnailProgress(float percentageDone)
IIOWriteProgressListener
s by calling
their thumbnailProgress
method. Subclasses may
use this method as a convenience.percentageDone
- the current percentage of completion,
as a float
.protected void processThumbnailComplete()
IIOWriteProgressListener
s by calling their
thumbnailComplete
method. Subclasses may use this
method as a convenience.protected void processWriteAborted()
IIOWriteProgressListener
s by calling their
writeAborted
method. Subclasses may use this
method as a convenience.protected void processWarningOccurred(int imageIndex, String warning)
IIOWriteWarningListener
s by calling their
warningOccurred
method. Subclasses may use this
method as a convenience.imageIndex
- the index of the image on which the warning
occurred.warning
- the warning message.IllegalArgumentException
- if warning
is null
.protected void processWarningOccurred(int imageIndex, String baseName, String keyword)
IIOWriteWarningListener
s by calling their
warningOccurred
method with a string taken
from a ResourceBundle
. Subclasses may use this
method as a convenience.imageIndex
- the index of the image on which the warning
occurred.baseName
- the base name of a set of
ResourceBundle
s containing localized warning
messages.keyword
- the keyword used to index the warning message
within the set of ResourceBundle
s.IllegalArgumentException
- if baseName
is null
.IllegalArgumentException
- if keyword
is null
.IllegalArgumentException
- if no appropriate
ResourceBundle
may be located.IllegalArgumentException
- if the named resource is
not found in the located ResourceBundle
.IllegalArgumentException
- if the object retrieved
from the ResourceBundle
is not a
String
.public void reset()
ImageWriter
to its initial state.
The default implementation calls
setOutput(null)
, setLocale(null)
,
removeAllIIOWriteWarningListeners()
,
removeAllIIOWriteProgressListeners()
, and
clearAbortRequest
.
public void dispose()
finalize
) subsequent to a call to this method
is undefined.
It is important for applications to call this method when they
know they will no longer be using this ImageWriter
.
Otherwise, the writer may continue to hold on to resources
indefinitely.
The default implementation of this method in the superclass does nothing. Subclass implementations should ensure that all resources, especially native resources, are released.
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2015, Oracle and/or its affiliates. All rights reserved.


DashFeed
{% if badPrompt %}
Oops! Looks like you missed something.
{% endif %} {% if goodPrompt %}
Yay! Your article just got published.
{% endif %}
Publish Your Article
Subtitle
Tag
Publish


Shutdown
Toasts
Import
Export
Import
Export
Stage Configuration
Iterations
Max Turns
Seed
Boss
Boss HP Override
Extra Event Bonus
Event Multiplier
Actors (front to back)
Add Actor
Remove Actor
First is guest
Song
Effect 1
Type
Value
Condition 1
Condition 2
Effect 2
Type
Value
Condition 1
Condition 2
Effect 3 (Passive)
Type
Value
Condition 1
Condition 2
Strategy
Type
Value
Boss Strategy Override
Type
Value
Donate
Cancel
Simulate
Results
Error
Log


Overview¶
What is gnewcash?¶
GNewCash is a Python package built for reading, writing, and interacting with GnuCash files. It is an alternative to using the GnuCash Python bindings. If you find issues using GNewCash, please add it to our issue tracker.
Compatibility¶
Python¶
GNewCash is developed on Python 3.7, and unit tests run on the following versions:
- 3.4
- 3.5
- 3.6
- 3.7
If you find your Python version listed above but are running into issues, please submit an issue to our issue tracker.
GNewCash¶
This package only relies on the Python standard library, so it should be compatible with Windows, Mac OSX, and Linux.
All code and tests are designed for GnuCash version 2 files. Version 3 is also supported.
Liability¶
GNewCash is released under the MIT license, and as such you are allowed to perform all actions listed in the license.
As expressed in the license, I hold no liability in the event that GnuCash corrupts or incorrectly modifies your data. I highly recommend backing up GnuCash files before operating on them with GNewCash.


Profiling a .NET Core Application on Linux
In the same vein of my previous post on analyzing core dumps of .NET Core applications on Linux, let’s take a look at what it takes to do some basic performance profiling.
19/07/2018


Game
Home
Guessing Game Page
Question 1: Did I live on Mars for a couple of years?
Question 2: Do I have any pets?


Private experiments or array designs
1. How to search for private data
2. Forgotten passwords and reviewers with no password
1. How to search for private data
When a pre-/un-published experiment or array design is loaded into ArrayExpress, the submitter is sent details of login accounts for themselves, and for journal editors and reviewers so that they can view the data before it is publicly available.
If you have such a login account, simply use the "Login" link at the right hand side of the top menu bar:
A pop up box will appear for you to enter the username and password you have been sent:
If the 'Remember me' box is checked, the login details will be remembered by your web browser, even if you close the browser and shut down your computer.
Once you've logged in, search for the experiment you would like to view by entering its accession number in the search box and click "Search"
2. Forgotten passwords and reviewers with no password
Submitters: If you're trying to view a private, curated experiment that you submitted to ArrayExpress, but have forgotten your ArrayExpress data access account login and/or password, use the "Forgot user name or password?" link on the login box:
(Note: This is the account for viewing curated data only, and not for submitting new experiments to us.)
A new form would appear where you'll fill in the email address you used for the experiment submission, and the experiment's accession number:
Reviewers: If you are a reviewer and have not been provided with an ArrayExpress login to access private data connected to a publication, please contact the data submitter, via the journal, to request this information. We cannot provide access to private data without first getting authorization from the submitter or journal.


The process of using the particle manager class is to, create it, add an effect to it and then update and draw in the OnCreate, OnUpdate and OnRender methods in a monkey App class:
'The minimum we need to import is mojo, std and of course timelinefx!
Using mojo..
Using std..
Using timelinefx..
'Create a simple Monky App Class
Class FXexample Extends Window
'Create some fields to store an effects libray, effect, and a particle manager.
Field MyEffects:tlEffectsLibrary
Field MyEffect:tlEffect
Field MyParticleManager:tlParticleManager
Field Paused:Int
Field EffectNames:String[]
Field CurrentEffect:Int
Field stop:int
'In the OnCreate method you can load your effects
'library and set up the particle manager.
Method New(title:String,width:Int,height:Int)
Super.New( title, width, height )
'load the effects file. See the docs on LoadEffects on how to
'prepare an effects library for use in monkey.
MyEffects = LoadEffects("asset::explosions")
'Use GetEffect, to retrieve an effect from the library.
MyEffect = MyEffects.GetEffect("glowing explosion")
'create a particle manager to manage all the effects and particles
MyParticleManager = CreateParticleManager(5000)
'Set the number of times per second that you want the particles to
'be updated. Best to set this to the UpdateRate
SetUpdateFrequency(60)
'Let the Particle manager know the screen size
MyParticleManager.SetScreenSize(Width, Height)
'Set the origin so that we can use mouse coords to place effects on screen
MyParticleManager.SetOrigin(Width / 2, Height / 2)
Local effects:=MyEffects.Effects
'Get the effect names in the library so we can loop through them
EffectNames = New String[effects.Count()]
Local i:int
For Local name:=Eachin effects.Keys
If Not name.Contains("/")
EffectNames[i] = name
i+=1
End If
Next
EffectNames = EffectNames.Slice(0, i-1)
Print EffectNames.Length
End
'Use the OnRender method to render all particles
Method OnRender(canvas:Canvas) Override
'lets create an effect everytime the mouse is clicked
If Keyboard.KeyHit(Key.Z)
CurrentEffect-=1
If CurrentEffect < 0 CurrentEffect = EffectNames.Length-1
End If
If Keyboard.KeyHit(Key.X)
CurrentEffect+=1
If CurrentEffect > EffectNames.Length-1 CurrentEffect = 0
End If
If stop
'DebugStop()
stop = False
End If
If Mouse.ButtonHit(MouseButton.Left)
'Copy the effect *Important! Dont just add an effect directly from the
'library, make a copy of it first*
Local tempeffect:tlEffect
MyEffect = MyEffects.GetEffect(EffectNames[CurrentEffect])
tempeffect = CopyEffect(MyEffect, MyParticleManager)
'Position the effect where we want it
tempeffect.SetPosition(Mouse.X, Mouse.Y)
'Add the effect to the particle manager
MyParticleManager.AddEffect(tempeffect)
stop = True
EndIf
If Keyboard.KeyHit(Key.P)
Paused = ~Paused
End If
If Keyboard.KeyHit(Key.Space)
MyParticleManager.ClearAll()
End If
Local updatetime:= Millisecs()
If Not Paused
'Update the particle manager
MyParticleManager.Update()
End If
updatetime = Millisecs() - updatetime
App.RequestRender()
canvas.Clear( New Color(0,0,0,1) )
'draw the particles
Local rendertime:= Millisecs()
MyParticleManager.DrawParticles(canvas)
rendertime = Millisecs() - rendertime
canvas.Color = New Color(1,1,1,1)
canvas.DrawText ("Press space to clear particles", 10, 10)
canvas.DrawText ("Current Effect (use z & x to change): " + EffectNames[CurrentEffect], 10, 30)
canvas.DrawText ( App.FPS, 10, 50)
End
End
Function Main()
New AppInstance
New FXexample("Particle Manager", 1024, 768)
App.Run()
End
The particle manager maintains 2 lists of particles, an Inuse list for particles currently in the rendering pipeline and an UnUsed list for a pool of particles that can be used by emitters at any time. You can control the maximum number of particles a particle manager can use when you create it:
local MaximumParticles:int=2500
local MyParticleManager:tlParticleManager=CreateParticleManager(MaximumParticles)
When emitters need to spawn new particles they will try and grab the next available particle in the Unused list.
The command SetScreenSize tells the particle manager the size of the viewport currently being rendered to. With this information it locates the center of the screen. This is important because the effects do not locate themselves using screen coordinates, they instead use an abritrary set of world coordinates. So if you place an effect at the coordinates 0,0 it will be drawn at the center of the screen. But don't worry, if you want to use screen coordinates to place your effects you can use the SetOrigin command to offset the world coordinates to screen space:
MyParticleManager.SetScreenSize(Width,Height
MyParticleManager.SetOrigin(Width/2,Height/2)
This will place the origin at the top-left of the viewport so effects placed at 0,0 now will be drawn in the top-left corner of the screen in the same way DrawImage would. If however your application uses it's own world coordinate system to postion entities then it should be easy to use #SetOrigin to syncronise the location of any effects with your app.
| Public Properties | |
|---|---|
| CurrentTime | The current time in millisecs since the particle manager has been updated.. |
| GlobalAmountScale | The Global amount scale is used to control the overal number of particles that will be spawned.. |
| IdleTimeLimit | Set the idle time limit to control how long before an idle effect is removed from the particle manager's list of effects. |
| Origin | Get/Set the origin of the particle manager |
| ParticlesInUse | Returns the number of particles currently in use by the particle manager.. |
| Public Constructors | |
|---|---|
| New | Constructor for tlParticleManager. |
| Public Methods | |
|---|---|
| AddEffect | Adds a new effect to the particle manager. |
| ClearAll | Remove all effects and clear all particles in use. |
| ClearInUse | Clear all particles in use. |
| DisableSetColor | Disable the particles from rendering using set colour. |
| DrawParticles | Draw all particles currently in use. |
| EnableSetColor | Enable the use of set colour for rendering particles.. |
| GetGlobalAmountScale | Get the globalamountscale value of the particle manager. |
| RemoveEffect | Removes an effect from the particle manager. |
| SetGlobalAmountScale | Set the globalamountscale value of the particle manager. |
| SetIdleTimeLimit | Set the amount of time before idle effects are deleted from the particle manager. |
| SetOrigin | Set the Origin of the particle Manager.. |
| SetOrigin_X | Set the x origin. |
| SetOrigin_Y | Set the y origin. |
| SetScreenPosition | Set the current screen position. |
| SetScreenSize | Set the current screen size. |
| SetZoom | Set the level of zoom. |
| Togglepause | Pause and unpause the particle manager. |
| Update | Update the Particle Manager. |


Adequate conditioning is essential to get the most out of any resistance-training program, whether we like cardio or not! If you’re interested in learning more about the basics of conditioning for strength and physique training (not strength and conditioning for other sports), here is a great starting place. Thoughtfully and slowly improving conditioning will improve your work capacity in the gym, your ability to recover between sets and between workouts, and will just help you feel better in general.
SBF Conditioning for Strength is coaching and programming for anyone who wants to improve their conditioning to get the most out of lifting. Together we will build and incorporate a conditioning regimen into your lifting program (and your life in general).
Coaching is about much more than just changing spreadsheets every couple of weeks. I'm here to build a genuine relationship with you and provide you with support, guidance, mentoring, and education. I truly believe that we can both learn so much from one another, and in doing so, we'll work together to set reasonable goals and expectations, and work toward them in a healthy, safe, and sustainable way.
***Before submitting your Application Form please read this entire page***
The recommended full price is $55 per month, but the minimum price only $35 per month, charged automatically each month until we feel you are ready to continue your conditioning training independently. You can choose to pay the full $55 per month, or as much as you feel the coaching services are worth. The extra money will go directly to paying for coaching services for those who cannot afford to pay full price. I have lower sliding-scale prices available upon request. I am also willing to negotiate barter-and-trading of services. No matter what, I do not turn anyone away due to lack of funds, so if you are concerned please send me an email and we'll figure something out for you.
All prices are in US Dollars.
All new clients must begin by filling out the intake and application forms, which can be found by clicking the link at the bottom of this page. After submitting the form, you will receive an email from nat on the next steps you’ll need to take to pay for this coaching service and schedule our initial consultation. Please be patient and allow at least 3 business days to receive this email response to your application.
If you are a returning client, please email me at<EMAIL_ADDRESS>letting me know. I will send you the link to the payment page so you can go directly to pay and book a video consultation with me right away. You will not have to fill out another application and intake form.


This page highlights the basic features of SourceJS documentation pages that we call Specs. To create your own Spec, follow this short guide.
This page highlights the basic features of SourceJS documentation pages that we call Specs. To create your own Spec, follow this short guide.
For text description, SourceJS uses basic HTML markup, and custom CSS class hooks. To render highlighted description block like this, add .source_info
class to a any HTML element on page.
| name | version | bundle |
|---|---|---|
| widget-estatement | short guide | launchpad |
code full
code in p
code in div


{% extends 'layout-2-1-bleedbar.html' %}
{# HEAD items #}
{% block title -%}
Curriculum Review Tool | Consumer Financial Protection Bureau
{%- endblock title %}
{% block desc -%}
Our vision is a consumer finance marketplace that works for American consumers, responsible providers, and the economy as a whole.
{%- endblock desc %}
{% block og_image -%}
{# Optional property if you want to use Twitter's large card format
https://developer.twitter.com/en/docs/tweets/optimize-with-cards/overview/summary-card-with-large-image
#}
{%- endblock og_image %}
{% block og_desc -%}
{{ self.desc() }}
{%- endblock og_desc %}
{% block css -%}
{{ super() }}
{%- endblock css %}
{# BODY items #}
{% block header %}
It’s helpful to do a few things before starting the curriculum review.
Enter the information for the curriculum you’re reviewing.
We’re the Consumer Financial Protection Bureau (CFPB), a U.S. government agency that makes sure banks, lenders, and other financial companies treat you fairly.
Want to download or print a blank copy of the review?
Curriculum: A complete set of materials for teaching a focused subject area that includes learning objectives, teaching methods, assignments, handouts and teaching supports, and sequence of instruction
Dimension: A key aspect (content, utility, quality, and efficacy) of a financial education curriculum to be evaluated
Criteria: Important features or content areas of the curriculum
Indicator: Specific elements or characteristics of a curriculum related to an evaluation criterion
Components: Statements or questions that help you determine if the curriculum meets an indicator


Data availability is business-critical for most organizations.
Suppose that your customers have had problems accessing music streams on rare occasions. When you investigated, you found that these problems occurred during outages that affected the entire region. These occasions were rare but had a large impact.
To improve your company's data availability, you decide to investigate the replication options available for Azure Storage.
Here, you'll explore the different replication options for Azure Storage. You'll learn how they work and when to use them. You'll also see how to switch and migrate your data between them.
In Azure Storage, you have several options for replication. The choice you make depends on the level of resilience you need.
Locally redundant storage (LRS) copies your data three times across separate racks of hardware in a datacenter, inside one region. Even if there's a hardware failure, or if maintenance work is happening in the datacenter, this replication type ensures data is available for use.
LRS doesn't protect you from a datacenter-wide outage. If the datacenter goes down, you could lose your data.
With geographically redundant storage (GRS), your data is copied three times within one region, and three times in a secondary region that's paired with it. This way, if your primary region is experiencing an outage, your secondary region is available for use.
With GRS, your secondary region isn't available for read access until the primary region fails. If you want to read from the secondary region, even if the primary region hasn't failed, use RA-GRS for your replication type.
Zone-redundant storage (ZRS) copies your data in three storage clusters in a single region. Each cluster is in a different physical location and is considered as a single availability zone. Each cluster uses its own separate utilities for things like networking and power. If one datacenter is experiencing outage, your data remains accessible from another availability zone in the same Azure region.
Because all availability zones are in a single region, ZRS can't protect your data from a regional level outage.
Geo-zone-redundant storage (GZRS) combines the high availability benefits of ZRS with GRS. With this replication type, your data is copied across three availability zones in one region. Data is also replicated three times to another secondary region that's paired with it. This way, your zone-redundant data is also secure from regional level outage.
Read-access geo-zone-redundant storage (RA-GZRS) uses the same replication method as GZRS but lets you read from the secondary region. If you want to read the data that's replicated to the secondary region, even if your primary isn't experiencing downtime, use RA-GZRS for your replication type.
GZRS and RA-GZRS are currently available in the following regions:
A paired region is where an Azure region is paired with another in the same geographical location to protect against regional outage. Paired regions are used with GRS and GZRS replication types.
Here's a list showing some of the regions that are paired together.
The following table summarizes how many copies you get with each replication type and when you should use it.
You can switch your replication strategy for any storage account. The process you use depends on the current replication strategy for your account. For example, if you want to migrate from a storage account with LRS, you have two options:
If you're using a ZRS account, you can convert it to use GZRS. You convert an account using the Azure portal, the Azure CLI, or Azure PowerShell. For example, to convert your account to GZRS by using Azure PowerShell, you would use this command:
Set-AzStorageAccount -ResourceGroupName <resource-group> -AccountName <storage-account> -SkuName "Standard_GZRS"
You can also switch your account's replication type in the Azure portal. For example, to switch from ZRS to GZRS, go to your storage account, select configuration, and change the replication type.
You can also use live migration to migrate your data to an account that uses ZRS, GZRS, or RA-GZRS. Use live migration to avoid downtime or data loss. The duration of your live migration generally depends on the amount of data in your account.
Live migrations are done by creating an Azure support request in the Azure portal.
You'll then be contacted by a support representative about your live migration request.
There are some limitations to live migration. For example:
Manual migration is more flexible than live migration. For example, because you control the timing, you can use manual migration if you need completion by a fixed date.
To do a manual migration, you could use the AzCopy utility or one of the various third-party tools available.
For example, through AzCopy, you can run the following command in your terminal, which copies all blobs, directories, and containers in your storage account to another one.
azcopy copy 'https://<source-storage-account-name>.blob.core.windows.net/?<your-SAS-token>'
'https://<destination-storage-account-name>.blob.core.windows.net/' --recursive


Employee Page
Submit New Reimbursement Request
Amount
Pending Requests
Id
Submitter Id
Resolver Id
Submitter Email
Resolver Email
Amount
Status
Processed Requests
Id
Submitter Id
Resolver Id
Submitter Email
Resolver Email
Amount
Status


| | |
- __builtin__.object
-
- CDL
- ColorCorrection
- ColorDecision
class CDL(__builtin__.object) |
| |
The CDL
Holds :class:`.ColorDecision` instances. It can be indexed to reach each
of the :class: `.ColorDecision` s like::
>>> cdl = CDL(flavour=CDL.XML_CDL)
>>> cdl.append(ColorDecision(color_decision_node))
>>> cdl[0]
:param str flavour: Optional cdl flavour definition defaults to XML, other
flavours to be added later.
`flavour` can be skipped |
| |
Methods defined here:
- __getitem__(self, item)
- returns ColorDecision by index
- __init__(self, flavour='xml_cdl', filename=None, timebase='24')
- __len__(self)
- gets length of color decisions for iterating over color decisions
- __repr__(self)
- returns string representation of CDL
- append(self, color_item)
- edls_enabled(self)
- first_color_item(self)
- returns the first color item in the list, simple function,
throws exception if no color item
- get_color_items(self)
- get_dom(self, cdl_string)
- get_item_type(self)
- load(self, filename)
- Loads CDL from filename, passes to the read function for loading
- loads(self, cdl_string)
- Loads CDL from string, depending on the flavour definition it passes
to the processing function
- parse_edl(self, cdl_string)
- parse_xml(self, cdl_string)
- Parse CDL XML string into ColorDecision objects
- read(self, filehandle)
- Reads CDL from Filehandle, passed to loads for processing
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes defined here:
- COLOR_CORRECTION = 'COLOR_CORRECTION'
- COLOR_DECISION = 'COLOR_DECISION'
- EDL_CDL = 'edl_cdl'
- XML_CDL = 'xml_cdl'
|
class ColorCorrection(__builtin__.object) |
| |
An individual color correction object |
| |
Methods defined here:
- __init__(self, color_correction_node=None, cdl_edl_strings=None, source_file=None)
- initialise object with a color correction dom object, optional
- __repr__(self)
- Returns a string representation of the color correction
- get_correction_id(self)
- load_dom(self, correction_dom)
- Load the color correction from a dom node passed to it. Does not throw
exception but logs parsing errors to the
ERROR log output
- process_edl_string(self, s)
- set_correction_id(self, correction_id)
- to_JSON(self)
Static methods defined here:
- get_attribute_value_by_name(node, attribute_name)
- get_float_from_node(node)
- Returns the floating point number contained within the node passed to it
- get_float_tuple_from_node(node)
- Returns the floating point numbers as a list contained within the node
passed to it
- get_float_tuple_from_text(text_string)
- Returns the floating point numbers as a list contained within the text
passed to it
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
- correction_id
- filename
- offset
- power
- saturation
- slope
|
class ColorDecision(__builtin__.object) |
| |
A singular color decision can contain multiple color corrections |
| |
Methods defined here:
- __getitem__(self, item)
- Returns color correction object based on index
- __init__(self, color_decision_node=None, decision_id=None, source_file=None)
- initialise object with a color decision dom object, optional
- __len__(self)
- Returns number of color corrections available
- __repr__(self)
- Rteurns a string representation of the color decision
- append(self, color_correction)
- first_correction(self)
- Returns the first available correction in the system throws exception
if none available
- get_corrections(self)
- load_dom(self, decision_dom)
- Load the color decision from a dom node passed to it.
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
| |


requires
directive.
An automatic module is unreliable since it can depend on the types on the class path, and its name and exported packages can change if it's converted into an explicit module.
Corresponds to -Xlint:requires-automatic
and -Xlint:requires-transitive-automatic
Javac options.
The first option increases awareness of when automatic modules are used.
The second warns the authors of a module that they're putting the users of that module at risk by establishing implied readability to an automatic module.
Example:
//module-info.java
module org.printer {
requires transitive drivers.corp.org; // reported in case 'drivers.corp.org' is an automatic module
}
Use the Highlight only transitive dependencies option to warn only about transitive dependencies.


Sgvizler
Test page for Sgvizler. Tests external endpoints using JSONP.
21: Map+, external endpoint
22: List, external endpoint
23: Wilbert's Projects


--- layout: archive title: Zulip Chat Archive permalink: /stream/113489-new-members/topic/How.20do.20I.20.22cast.22.20inequalities.3F.html ---
If I have (1 ≤ n)
as ℕ
how do I get (1:ℝ)≤ ↑n
? Library search didn't help.
norm_cast
is supposed to help in such situations
import data.real.basic example (n : ℕ) (h : 1 ≤ n) : (1 : ℝ) ≤ n := begin exact_mod_cast h end
Someone asked me this at Xena yesterday and I revised all the various flavours of norm_cast ;-)
{% endraw %}Last updated: Apr 24 2020 at 19:02 UTC