Package org.cesilko.rachota.gui
Class PNGImageWriter
java.lang.Object
org.cesilko.rachota.gui.PNGImageWriter
Encoder for writing BufferedImage as true color PNG
image with maximum compression.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) CRC32
Checksum computer.(package private) OutputStream
Output stream representing file where image should be saved. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) void
write
(byte[] array) Writes given byte array to output stream and updates checksum.(package private) void
write
(int number) Transforms given number to byte array and writes it.void
write
(BufferedImage image, OutputStream outputStream) Writes given buffered image to given output stream.
-
Field Details
-
checksum
CRC32 checksumChecksum computer. -
outputStream
OutputStream outputStreamOutput stream representing file where image should be saved.
-
-
Constructor Details
-
PNGImageWriter
public PNGImageWriter()
-
-
Method Details
-
write
Transforms given number to byte array and writes it.- Parameters:
number
- Number to be transformed and written.- Throws:
IOException
- Exception thrown when any I/O problem occurs.
-
write
Writes given byte array to output stream and updates checksum.- Parameters:
array
- Byte array to be written.- Throws:
IOException
- Exception thrown when any I/O problem occurs.
-
write
Writes 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:
IOException
- Exception thrown when any I/O problem occurs.
-