请问ImageIO.write(image, "bmg", filWriterOne);括号里的三个参数分别代表说明意思?
image:图片对象
"bmg" :图片格式
, filWriterOne 需要写入的地方
源码中有三个方法
/**
* Writes an image using the an arbitrary <code>ImageWriter</code>
* that supports the given format to an
* <code>ImageOutputStream</code>. The image is written to the
* <code>ImageOutputStream</code> starting at the current stream
* pointer, overwriting existing stream data from that point
* forward, if present.
*
* <p> This method <em>does not</em> close the provided
* <code>ImageOutputStream</code> after the write operation has completed;
* it is the responsibility of the caller to close the stream, if desired.
*
* @param im a <code>RenderedImage</code> to be written.
* @param formatName a <code>String</code> containing the informal
* name of the format.
* @param output an <code>ImageOutputStream</code> to be written to.
*
* @return <code>false</code> if no appropriate writer is found.
*
* @exception IllegalArgumentException if any parameter is
* <code>null</code>.
* @exception IOException if an error occurs during writing.
*/
public static boolean write(RenderedImage im,
String formatName,
ImageOutputStream output) throws IOException {
if (im == null) {
throw new IllegalArgumentException("im == null!");
}
if (formatName == null) {
throw new IllegalArgumentException("formatName == null!");
}
if (output == null) {
throw new IllegalArgumentException("output == null!");
}
return doWrite(im, getWriter(im, formatName), output);
}
/**
* Writes an image using an arbitrary <code>ImageWriter</code>
* that supports the given format to a <code>File</code>. If
* there is already a <code>File</code> present, its contents are
* discarded.
*
* @param im a <code>RenderedImage</code> to be written.
* @param formatName a <code>String</code> containing the informal
* name of the format.
* @param output a <code>File</code> to be written to.
*
* @return <code>false</code> if no appropriate writer is found.
*
* @exception IllegalArgumentException if any parameter is
* <code>null</code>.
* @exception IOException if an error occurs during writing.
*/
public static boolean write(RenderedImage im,
String formatName,
File output) throws IOException {
if (output == null) {
throw new IllegalArgumentException("output == null!");
}
ImageOutputStream stream = null;
ImageWriter writer = getWriter(im, formatName);
if (writer == null) {
/* Do not make changes in the file system if we have
* no appropriate writer.
*/
return false;
}
try {
output.delete();
stream = createImageOutputStream(output);
} catch (IOException e) {
throw new IIOException("Can't create output stream!", e);
}
try {
return doWrite(im, writer, stream);
} finally {
stream.close();
}
}
/**
* Writes an image using an arbitrary <code>ImageWriter</code>
* that supports the given format to an <code>OutputStream</code>.
*
* <p> This method <em>does not</em> close the provided
* <code>OutputStream</code> after the write operation has completed;
* it is the responsibility of the caller to close the stream, if desired.
*
* <p> The current cache settings from <code>getUseCache</code>and
* <code>getCacheDirectory</code> will be used to control caching.
*
* @param im a <code>RenderedImage</code> to be written.
* @param formatName a <code>String</code> containing the informal
* name of the format.
* @param output an <code>OutputStream</code> to be written to.
*
* @return <code>false</code> if no appropriate writer is found.
*
* @exception IllegalArgumentException if any parameter is
* <code>null</code>.
* @exception IOException if an error occurs during writing.
*/
public static boolean write(RenderedImage im,
String formatName,
OutputStream output) throws IOException {
if (output == null) {
throw new IllegalArgumentException("output == null!");
}
ImageOutputStream stream = null;
try {
stream = createImageOutputStream(output);
} catch (IOException e) {
throw new IIOException("Can't create output stream!", e);
}
try {
return doWrite(im, getWriter(im, formatName), stream);
} finally {
stream.close();
}
}