Class BarcodeReader


  • public class BarcodeReader
    extends java.lang.Object
    Barcode reader implementation that will scan an image for a barcode.
    Author:
    Christopher Mindus
    • Constructor Summary

      Constructors 
      Constructor Description
      BarcodeReader()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static BarcodeData readBarcode​(java.awt.image.BufferedImage image)
      Scans a BufferedImage and attempts to detect a single barcode.
      static BarcodeData readBarcode​(java.io.File file)
      Reads a file and attempts to detect a single barcode.
      static BarcodeData readBarcode​(java.io.InputStream in)
      Reads an input stream as an image of PNG or JPEG type and attempts to detect a single barcode.
      static BarcodeData readBarcode​(java.lang.String fileName)
      Reads a file and attempts to detect a single barcode.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • BarcodeReader

        public BarcodeReader()
    • Method Detail

      • readBarcode

        public static BarcodeData readBarcode​(java.lang.String fileName)
                                       throws java.io.IOException,
                                              NotFoundException
        Reads a file and attempts to detect a single barcode.
        Parameters:
        fileName - The file name to read.
        Returns:
        The barcode data.
        Throws:
        java.io.IOException - For file I/O errors.
        NotFoundException - If a barcode is not found.
      • readBarcode

        public static BarcodeData readBarcode​(java.io.File file)
                                       throws java.io.IOException,
                                              NotFoundException
        Reads a file and attempts to detect a single barcode.
        Parameters:
        file - The file to read.
        Returns:
        The barcode data.
        Throws:
        java.io.IOException - For file I/O errors.
        NotFoundException - If a barcode is not found.
      • readBarcode

        public static BarcodeData readBarcode​(java.io.InputStream in)
                                       throws java.io.IOException,
                                              NotFoundException
        Reads an input stream as an image of PNG or JPEG type and attempts to detect a single barcode.
        Parameters:
        in - The input stream to read.

        Note: it is up to the caller to close the input stream.

        Returns:
        The barcode data.
        Throws:
        java.io.IOException - For I/O errors.
        NotFoundException - If a barcode is not found.
      • readBarcode

        public static BarcodeData readBarcode​(java.awt.image.BufferedImage image)
                                       throws java.io.IOException,
                                              NotFoundException
        Scans a BufferedImage and attempts to detect a single barcode.
        Parameters:
        image - The image.
        Returns:
        The barcode data.
        Throws:
        NotFoundException - If a barcode is not found.
        java.io.IOException