Package org.cesilko.rachota.gui
Class PNGImageWriter
- java.lang.Object
-
- org.cesilko.rachota.gui.PNGImageWriter
-
public class PNGImageWriter extends java.lang.ObjectEncoder for writing BufferedImage as true color PNG image with maximum compression.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) java.util.zip.CRC32checksumChecksum computer.(package private) java.io.OutputStreamoutputStreamOutput stream representing file where image should be saved.
-
Constructor Summary
Constructors Constructor Description PNGImageWriter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) voidwrite(byte[] array)Writes given byte array to output stream and updates checksum.(package private) voidwrite(int number)Transforms given number to byte array and writes it.voidwrite(java.awt.image.BufferedImage image, java.io.OutputStream outputStream)Writes given buffered image to given output stream.
-
-
-
Method Detail
-
write
void write(int number) throws java.io.IOExceptionTransforms given number to byte array and writes it.- Parameters:
number- Number to be transformed and written.- Throws:
java.io.IOException- Exception thrown when any I/O problem occurs.
-
write
void write(byte[] array) throws java.io.IOExceptionWrites given byte array to output stream and updates checksum.- Parameters:
array- Byte array to be written.- Throws:
java.io.IOException- Exception thrown when any I/O problem occurs.
-
write
public void write(java.awt.image.BufferedImage image, java.io.OutputStream outputStream) throws java.io.IOExceptionWrites given buffered image to given output stream.- Parameters:
image- Buffered image to be written.outputStream- Output stream representing file where image should be saved.- Throws:
java.io.IOException- Exception thrown when any I/O problem occurs.
-
-