Class PNGImageWriter

java.lang.Object
org.cesilko.rachota.gui.PNGImageWriter

public class PNGImageWriter extends Object
Encoder for writing BufferedImage as true color PNG image with maximum compression.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    (package private) CRC32
    Checksum computer.
    (package private) OutputStream
    Output stream representing file where image should be saved.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    (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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • checksum

      CRC32 checksum
      Checksum computer.
    • outputStream

      OutputStream outputStream
      Output stream representing file where image should be saved.
  • Constructor Details

    • PNGImageWriter

      public PNGImageWriter()
  • Method Details

    • write

      void write(int number) throws IOException
      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

      void write(byte[] array) throws IOException
      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

      public void write(BufferedImage image, OutputStream outputStream) throws IOException
      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.