Class MultiFormatReader

  • All Implemented Interfaces:
    Reader

    public final class MultiFormatReader
    extends java.lang.Object
    implements Reader
    MultiFormatReader is a convenience class and the main entry point into the library for most uses. By default it attempts to decode all barcode formats that the library supports. Optionally, you can provide a hints object to request different behavior, for example only decoding QR codes.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Result decode​(BinaryBitmap image)
      This version of decode honors the intent of Reader.decode(BinaryBitmap) in that it passes null as a hint to the decoders.
      Result decode​(BinaryBitmap image, java.util.Map<DecodeHintType,​?> hints)
      Decode an image using the hints provided.
      Result decodeWithState​(BinaryBitmap image)
      Decode an image using the state set up by calling setHints() previously.
      void reset()
      Resets any internal state the implementation has after a decode, to prepare it for reuse.
      void setHints​(java.util.Map<DecodeHintType,​?> hints)
      This method adds state to the MultiFormatReader.
      • Methods inherited from class java.lang.Object

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

      • MultiFormatReader

        public MultiFormatReader()
    • Method Detail

      • decode

        public Result decode​(BinaryBitmap image)
                      throws NotFoundException
        This version of decode honors the intent of Reader.decode(BinaryBitmap) in that it passes null as a hint to the decoders. However, that makes it inefficient to call repeatedly. Use setHints() followed by decodeWithState() for continuous scan applications.
        Specified by:
        decode in interface Reader
        Parameters:
        image - The pixel data to decode
        Returns:
        The contents of the image
        Throws:
        NotFoundException - Any errors which occurred
      • decode

        public Result decode​(BinaryBitmap image,
                             java.util.Map<DecodeHintType,​?> hints)
                      throws NotFoundException
        Decode an image using the hints provided. Does not honor existing state.
        Specified by:
        decode in interface Reader
        Parameters:
        image - The pixel data to decode
        hints - The hints to use, clearing the previous state.
        Returns:
        The contents of the image
        Throws:
        NotFoundException - Any errors which occurred
      • decodeWithState

        public Result decodeWithState​(BinaryBitmap image)
                               throws NotFoundException
        Decode an image using the state set up by calling setHints() previously. Continuous scan clients will get a large speed increase by using this instead of decode().
        Parameters:
        image - The pixel data to decode
        Returns:
        The contents of the image
        Throws:
        NotFoundException - Any errors which occurred
      • setHints

        public void setHints​(java.util.Map<DecodeHintType,​?> hints)
        This method adds state to the MultiFormatReader. By setting the hints once, subsequent calls to decodeWithState(image) can reuse the same set of readers without reallocating memory. This is important for performance in continuous scan clients.
        Parameters:
        hints - The set of hints to use for subsequent calls to decode(image)
      • reset

        public void reset()
        Description copied from interface: Reader
        Resets any internal state the implementation has after a decode, to prepare it for reuse.
        Specified by:
        reset in interface Reader