Methods Summary |
---|
public synchronized void | abort()Requests an abort operation for current writing operation.
aborted = true;
|
protected synchronized boolean | abortRequested()Checks whether or not a request to abort the current write operation has
been made successfully.
return aborted;
|
public void | addIIOWriteProgressListener(javax.imageio.event.IIOWriteProgressListener listener)Adds the IIOWriteProgressListener listener.
if (listener == null) {
return;
}
if (progressListeners == null) {
progressListeners = new ArrayList<IIOWriteProgressListener>();
}
progressListeners.add(listener);
|
public void | addIIOWriteWarningListener(javax.imageio.event.IIOWriteWarningListener listener)Adds the IIOWriteWarningListener.
if (listener == null) {
return;
}
if (warningListeners == null) {
warningListeners = new ArrayList<IIOWriteWarningListener>();
warningLocales = new ArrayList<Locale>();
}
warningListeners.add(listener);
warningLocales.add(getLocale());
|
public boolean | canInsertEmpty(int imageIndex)Returns true if a new empty image can be inserted at the specified index.
return checkOutputReturnFalse();
|
public boolean | canInsertImage(int imageIndex)Returns true if a new image can be inserted at the specified index.
return checkOutputReturnFalse();
|
public boolean | canRemoveImage(int imageIndex)Returns true if the image with the specified index can be removed.
return checkOutputReturnFalse();
|
public boolean | canReplaceImageMetadata(int imageIndex)Returns true if metadata of the image with the specified index can be
replaced.
return checkOutputReturnFalse();
|
public boolean | canReplacePixels(int imageIndex)Returns true if pixels of the image with the specified index can be
replaced by the replacePixels methods.
return checkOutputReturnFalse();
|
public boolean | canReplaceStreamMetadata()Returns true if the stream metadata presented in the output can be
removed.
return checkOutputReturnFalse();
|
public boolean | canWriteEmpty()Returns true if the writing of a complete image stream which contains a
single image is supported with undefined pixel values and associated
metadata and thumbnails to the output.
return checkOutputReturnFalse();
|
public boolean | canWriteRasters()Returns true if the methods which taken an IIOImageParameter can deal
with a Raster source image.
return false;
|
public boolean | canWriteSequence()Returns true if the writer can add an image to stream that already
contains header information.
return false;
|
private final boolean | checkOutputReturnFalse()Check output return false.
if (getOutput() == null) {
throw new IllegalStateException("getOutput() == null!");
}
return false;
|
protected synchronized void | clearAbortRequest()Clears all previous abort request, and abortRequested returns false after
calling this method.
aborted = false;
|
public abstract javax.imageio.metadata.IIOMetadata | convertImageMetadata(javax.imageio.metadata.IIOMetadata iioMetadata, javax.imageio.ImageTypeSpecifier imageTypeSpecifier, javax.imageio.ImageWriteParam imageWriteParam)
|
public abstract javax.imageio.metadata.IIOMetadata | convertStreamMetadata(javax.imageio.metadata.IIOMetadata iioMetadata, javax.imageio.ImageWriteParam imageWriteParam)
|
public void | dispose()Disposes of any resources.
// def impl. does nothing according to the spec.
|
public void | endInsertEmpty()Ends the insertion of a new image.
unsupportedOperation();
|
public void | endReplacePixels()Ends the replace pixels operation.
unsupportedOperation();
|
public void | endWriteEmpty()Ends an empty write operation.
unsupportedOperation();
|
public void | endWriteSequence()Ends the sequence of write operations.
unsupportedOperation();
|
public java.util.Locale[] | getAvailableLocales()Gets an array of available locales.
if (availableLocales == null) {
return null;
}
return availableLocales.clone();
|
public abstract javax.imageio.metadata.IIOMetadata | getDefaultImageMetadata(javax.imageio.ImageTypeSpecifier imageType, javax.imageio.ImageWriteParam param)Gets an IIOMetadata object that contains default values for encoding an
image with the specified type.
|
public abstract javax.imageio.metadata.IIOMetadata | getDefaultStreamMetadata(javax.imageio.ImageWriteParam param)Gets an IIOMetadata object that contains default values for encoding a
stream of images.
|
public javax.imageio.ImageWriteParam | getDefaultWriteParam()Gets the default write param. Gets a new ImageWriteParam object for this
ImageWriter with the current Locale.
return new ImageWriteParam(getLocale());
|
public java.util.Locale | getLocale()Gets the current locale of this ImageWriter.
return locale;
|
public int | getNumThumbnailsSupported(javax.imageio.ImageTypeSpecifier imageType, javax.imageio.ImageWriteParam param, javax.imageio.metadata.IIOMetadata streamMetadata, javax.imageio.metadata.IIOMetadata imageMetadata)Gets the number of thumbnails supported by the format being written with
supported image type, image write parameters, stream, and image metadata
objects.
return 0;
|
public javax.imageio.spi.ImageWriterSpi | getOriginatingProvider()Gets the ImageWriterSpi which instantiated this ImageWriter.
return originatingProvider;
|
public java.lang.Object | getOutput()Gets the output object that was set by setOutput method.
return output;
|
public java.awt.Dimension[] | getPreferredThumbnailSizes(javax.imageio.ImageTypeSpecifier imageType, javax.imageio.ImageWriteParam param, javax.imageio.metadata.IIOMetadata streamMetadata, javax.imageio.metadata.IIOMetadata imageMetadata)Gets the preferred thumbnail sizes. Gets an array of Dimensions with the
sizes for thumbnail images as they are encoded in the output file or
stream.
return null;
|
public void | prepareInsertEmpty(int imageIndex, javax.imageio.ImageTypeSpecifier imageType, int width, int height, javax.imageio.metadata.IIOMetadata imageMetadata, java.util.List thumbnails, javax.imageio.ImageWriteParam param)Prepares insertion of an empty image by requesting the insertion of a new
image into an existing image stream.
unsupportedOperation();
|
public void | prepareReplacePixels(int imageIndex, java.awt.Rectangle region)Prepares the writer to call the replacePixels method for the specified
region.
unsupportedOperation();
|
public void | prepareWriteEmpty(javax.imageio.metadata.IIOMetadata streamMetadata, javax.imageio.ImageTypeSpecifier imageType, int width, int height, javax.imageio.metadata.IIOMetadata imageMetadata, java.util.List thumbnails, javax.imageio.ImageWriteParam param)Prepares the writer for writing an empty image by beginning the process
of writing a complete image stream that contains a single image with
undefined pixel values, metadata and thumbnails, to the output.
unsupportedOperation();
|
public void | prepareWriteSequence(javax.imageio.metadata.IIOMetadata streamMetadata)Prepares a stream to accept calls of writeToSequence method using the
metadata object.
unsupportedOperation();
|
protected void | processImageComplete()Processes image completion by calling imageComplete method of registered
IIOWriteProgressListeners.
if (null != progressListeners) {
for (IIOWriteProgressListener listener : progressListeners) {
listener.imageComplete(this);
}
}
|
protected void | processImageProgress(float percentageDone)Processes the current percentage of image completion by calling
imageProgress method of registered IIOWriteProgressListener.
if (null != progressListeners) {
for (IIOWriteProgressListener listener : progressListeners) {
listener.imageProgress(this, percentageDone);
}
}
|
protected void | processImageStarted(int imageIndex)Processes the start of an image read by calling their imageStarted method
of registered IIOWriteProgressListeners.
if (null != progressListeners) {
for (IIOWriteProgressListener listener : progressListeners) {
listener.imageStarted(this, imageIndex);
}
}
|
protected void | processThumbnailComplete()Processes the completion of a thumbnail read by calling their
thumbnailComplete method of registered IIOWriteProgressListeners.
if (progressListeners != null) {
for (IIOWriteProgressListener listener : progressListeners) {
listener.thumbnailComplete(this);
}
}
|
protected void | processThumbnailProgress(float percentageDone)Processes the current percentage of thumbnail completion by calling their
thumbnailProgress method of registered IIOWriteProgressListeners.
if (progressListeners != null) {
for (IIOWriteProgressListener listener : progressListeners) {
listener.thumbnailProgress(this, percentageDone);
}
}
|
protected void | processThumbnailStarted(int imageIndex, int thumbnailIndex)Processes the start of a thumbnail read by calling thumbnailStarted
method of registered IIOWriteProgressListeners.
if (progressListeners != null) {
for (IIOWriteProgressListener listener : progressListeners) {
listener.thumbnailStarted(this, imageIndex, thumbnailIndex);
}
}
|
protected void | processWarningOccurred(int imageIndex, java.lang.String warning)Processes a warning message by calling warningOccurred method of
registered IIOWriteWarningListeners.
if (null == warning) {
throw new NullPointerException("warning message should not be NULL");
}
if (null != warningListeners) {
for (IIOWriteWarningListener listener : warningListeners) {
listener.warningOccurred(this, imageIndex, warning);
}
}
|
protected void | processWarningOccurred(int imageIndex, java.lang.String bundle, java.lang.String key)Processes a warning message by calling warningOccurred method of
registered IIOWriteWarningListeners with string from ResourceBundle.
if (warningListeners != null) { // Don't check the parameters
return;
}
if (bundle == null) {
throw new IllegalArgumentException("baseName == null!");
}
if (key == null) {
throw new IllegalArgumentException("keyword == null!");
}
// Get the context class loader and try to locate the bundle with it
// first
ClassLoader contextClassloader = AccessController
.doPrivileged(new PrivilegedAction<ClassLoader>() {
public ClassLoader run() {
return Thread.currentThread().getContextClassLoader();
}
});
// Iterate through both listeners and locales
int n = warningListeners.size();
for (int i = 0; i < n; i++) {
IIOWriteWarningListener listener = warningListeners.get(i);
Locale locale = warningLocales.get(i);
// Now try to get the resource bundle
ResourceBundle rb;
try {
rb = ResourceBundle.getBundle(bundle, locale, contextClassloader);
} catch (MissingResourceException e) {
try {
rb = ResourceBundle.getBundle(bundle, locale);
} catch (MissingResourceException e1) {
throw new IllegalArgumentException("Bundle not found!");
}
}
try {
String warning = rb.getString(key);
listener.warningOccurred(this, imageIndex, warning);
} catch (MissingResourceException e) {
throw new IllegalArgumentException("Resource is missing!");
} catch (ClassCastException e) {
throw new IllegalArgumentException("Resource is not a String!");
}
}
|
protected void | processWriteAborted()Processes that the writing has been aborted by calling writeAborted
method of registered IIOWriteProgressListeners.
if (progressListeners != null) {
for (IIOWriteProgressListener listener : progressListeners) {
listener.writeAborted(this);
}
}
|
public void | removeAllIIOWriteProgressListeners()Removes the all IIOWriteProgressListener listeners.
progressListeners = null;
|
public void | removeAllIIOWriteWarningListeners()Removes the all IIOWriteWarningListener listeners.
warningListeners = null;
warningLocales = null;
|
public void | removeIIOWriteProgressListener(javax.imageio.event.IIOWriteProgressListener listener)Removes the specified IIOWriteProgressListener listener.
if (progressListeners != null && listener != null) {
if (progressListeners.remove(listener) && progressListeners.isEmpty()) {
progressListeners = null;
}
}
|
public void | removeIIOWriteWarningListener(javax.imageio.event.IIOWriteWarningListener listener)Removes the specified IIOWriteWarningListener listener.
if (warningListeners == null || listener == null) {
return;
}
int idx = warningListeners.indexOf(listener);
if (idx > -1) {
warningListeners.remove(idx);
warningLocales.remove(idx);
if (warningListeners.isEmpty()) {
warningListeners = null;
warningLocales = null;
}
}
|
public void | removeImage(int imageIndex)Removes the image with the specified index from the stream.
unsupportedOperation();
|
public void | replaceImageMetadata(int imageIndex, javax.imageio.metadata.IIOMetadata imageMetadata)Replaces image metadata of the image with specified index.
unsupportedOperation();
|
public void | replacePixels(java.awt.image.RenderedImage image, javax.imageio.ImageWriteParam param)Replaces a part of an image presented in the output with the specified
RenderedImage.
unsupportedOperation();
|
public void | replacePixels(java.awt.image.Raster raster, javax.imageio.ImageWriteParam param)Replaces a part of an image presented in the output with the specified
Raster.
unsupportedOperation();
|
public void | replaceStreamMetadata(javax.imageio.metadata.IIOMetadata streamMetadata)Replaces the stream metadata of the output with new IIOMetadata.
unsupportedOperation();
|
public void | reset()Resets this ImageWriter.
setOutput(null);
setLocale(null);
removeAllIIOWriteWarningListeners();
removeAllIIOWriteProgressListeners();
clearAbortRequest();
|
public void | setLocale(java.util.Locale locale)Sets the locale of this ImageWriter.
if (locale == null) {
this.locale = null;
return;
}
Locale[] locales = getAvailableLocales();
boolean validLocale = false;
if (locales != null) {
for (int i = 0; i < locales.length; i++) {
if (locale.equals(locales[i])) {
validLocale = true;
break;
}
}
}
if (validLocale) {
this.locale = locale;
} else {
throw new IllegalArgumentException("Invalid locale!");
}
|
public void | setOutput(java.lang.Object output)Sets the specified Object to the output of this ImageWriter.
if (output != null) {
ImageWriterSpi spi = getOriginatingProvider();
if (null != spi) {
Class[] outTypes = spi.getOutputTypes();
boolean supported = false;
for (Class<?> element : outTypes) {
if (element.isInstance(output)) {
supported = true;
break;
}
}
if (!supported) {
throw new IllegalArgumentException("output " + output + " is not supported");
}
}
}
this.output = output;
|
private final void | unsupportedOperation()Unsupported operation.
if (getOutput() == null) {
throw new IllegalStateException("getOutput() == null!");
}
throw new UnsupportedOperationException("Unsupported write variant!");
|
public void | write(javax.imageio.IIOImage image)Writes a completed image stream that contains the specified image,
default metadata, and thumbnails to the output.
write(null, image, null);
|
public void | write(java.awt.image.RenderedImage image)Writes a completed image stream that contains the specified rendered
image, default metadata, and thumbnails to the output.
write(null, new IIOImage(image, null, null), null);
|
public abstract void | write(javax.imageio.metadata.IIOMetadata streamMetadata, javax.imageio.IIOImage image, javax.imageio.ImageWriteParam param)Writes a completed image stream that contains the specified image,
metadata and thumbnails to the output.
|
public void | writeInsert(int imageIndex, javax.imageio.IIOImage image, javax.imageio.ImageWriteParam param)Inserts image into existing output stream.
unsupportedOperation();
|
public void | writeToSequence(javax.imageio.IIOImage image, javax.imageio.ImageWriteParam param)Writes the specified image to the sequence.
unsupportedOperation();
|