net.sourceforge.barbecue
Class BarcodeImageHandler

java.lang.Object
  extended bynet.sourceforge.barbecue.BarcodeImageHandler

public final class BarcodeImageHandler
extends java.lang.Object

Utility class to provide convenience methods for converting barcodes to images and other misc barcode handling.

Author:
Ian Bourke, Sean Sullivan

Method Summary
static java.awt.image.BufferedImage getImage(Barcode barcode)
          Creates an image for a barcode that can be used in other GUI components (e.g.
static java.util.Set getImageFormats()
           
static void saveGIF(Barcode barcode, java.io.File f)
           
static void saveJPEG(Barcode barcode, java.io.File f)
           
static void savePNG(Barcode barcode, java.io.File f)
           
static void writeGIF(Barcode barcode, java.io.OutputStream os)
          write a GIF image to an OutputStream
static void writeJPEG(Barcode barcode, java.io.OutputStream os)
          write a JPEG image to an OutputStream
static void writePNG(Barcode barcode, java.io.OutputStream os)
          write a PNG image to an OutputStream
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getImageFormats

public static java.util.Set getImageFormats()

getImage

public static java.awt.image.BufferedImage getImage(Barcode barcode)
                                             throws OutputException
Creates an image for a barcode that can be used in other GUI components (e.g. ImageIcon, JLabel etc).

Parameters:
barcode - The barcode to convert into an image
Returns:
The image
Throws:
OutputException

writeJPEG

public static void writeJPEG(Barcode barcode,
                             java.io.OutputStream os)
                      throws OutputException
write a JPEG image to an OutputStream

Parameters:
barcode - The barcode to output
os - The output stream to write the image to
Throws:
OutputException - If the image cannot be written to the output stream correctly

saveJPEG

public static void saveJPEG(Barcode barcode,
                            java.io.File f)
                     throws OutputException
Throws:
OutputException

savePNG

public static void savePNG(Barcode barcode,
                           java.io.File f)
                    throws OutputException
Throws:
OutputException

saveGIF

public static void saveGIF(Barcode barcode,
                           java.io.File f)
                    throws OutputException
Throws:
OutputException

writePNG

public static void writePNG(Barcode barcode,
                            java.io.OutputStream os)
                     throws OutputException
write a PNG image to an OutputStream

Parameters:
barcode - The barcode to output
os - The output stream to write the image to
Throws:
OutputException - If the image cannot be written to the output stream correctly

writeGIF

public static void writeGIF(Barcode barcode,
                            java.io.OutputStream os)
                     throws OutputException
write a GIF image to an OutputStream

Parameters:
barcode - The barcode to output
os - The output stream to write the image to
Throws:
OutputException - If the image cannot be written to the output stream correctly


Copyright © 2003-2007 barbecue.sourceforge.net. All Rights Reserved.