Class ImageIOBitmapEncoder

java.lang.Object
org.krysalis.barcode4j.output.bitmap.ImageIOBitmapEncoder
All Implemented Interfaces:
BitmapEncoder

public class ImageIOBitmapEncoder extends Object implements BitmapEncoder
BitmapEncoder implementation using ImageIO.
Author:
Jeremias Maerki
  • Constructor Details

    • ImageIOBitmapEncoder

      public ImageIOBitmapEncoder() throws ClassNotFoundException
      Constructs the BitmapEncoder. The constructor checks if the ImageIO API is available so it doesn't get registered in case it's not there.
      Throws:
      ClassNotFoundException - if the ImageIO API is unavailable
  • Method Details

    • getSupportedMIMETypes

      public String[] getSupportedMIMETypes()
      Returns an array of MIME types supported.
      Specified by:
      getSupportedMIMETypes in interface BitmapEncoder
      Returns:
      the array of MIME types
    • encode

      public void encode(BufferedImage image, OutputStream out, String mime, int resolution) throws IOException
      Encodes a BufferedImage to a target format and writes it to the OutputStream.
      Specified by:
      encode in interface BitmapEncoder
      Parameters:
      image - the image to encode
      out - the OutputStream to write the image to
      mime - the MIME type in which to encode the image
      resolution - the resolution in dpi of the image
      Throws:
      IOException - in case of an I/O problem