/**
* Get whether the encoder should encode alpha transparency (always false).
*
* @return Whether the encoder is encoding alpha transparency.
*/
/**
* Returns <code>false</code> always, indicating that this encoder does not
* encode alpha transparency.
*
* @return <code>false</code>.
*/
public boolean isEncodingAlpha() {
return false;
}
/**
* Set whether the encoder should encode alpha transparency (not
* supported in this ImageEncoder).
*
* @param encodingAlpha Whether the encoder should encode alpha
* transparency.
*/
/**
* Set whether the encoder should encode alpha transparency (this is not
* supported for JPEG, so this method does nothing).
*
* @param encodingAlpha ignored.
*/
public void setEncodingAlpha(boolean encodingAlpha) {
// No op
}
/**
* Encodes an image in PNG format.
*
* @param bufferedImage The image to be encoded.
*
* @return The byte[] that is the encoded image.
*
* @throws IOException
*/
/**
* Encodes an image in JPEG format.
*
* @param bufferedImage the image to be encoded (<code>null</code> not
* permitted).
*
* @return The byte[] that is the encoded image.
*
* @throws IOException if there is an I/O problem.
* @throws NullPointerException if <code>bufferedImage</code> is
* <code>null</code>.
*/
public byte[] encode(BufferedImage bufferedImage) throws IOException {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
encode(bufferedImage, outputStream);
return outputStream.toByteArray();
}
|