Class ImageIOBitmapEncoder
java.lang.Object
org.krysalis.barcode4j.output.bitmap.ImageIOBitmapEncoder
- All Implemented Interfaces:
BitmapEncoder
BitmapEncoder implementation using ImageIO.
- Author:
- Jeremias Maerki
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidencode(BufferedImage image, OutputStream out, String mime, int resolution) Encodes a BufferedImage to a target format and writes it to the OutputStream.String[]Returns an array of MIME types supported.
-
Constructor Details
-
ImageIOBitmapEncoder
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
Returns an array of MIME types supported.- Specified by:
getSupportedMIMETypesin interfaceBitmapEncoder- 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:
encodein interfaceBitmapEncoder- Parameters:
image- the image to encodeout- the OutputStream to write the image tomime- the MIME type in which to encode the imageresolution- the resolution in dpi of the image- Throws:
IOException- in case of an I/O problem
-