Package com.google.zxing
Class MultiFormatReader
java.lang.Object
com.google.zxing.MultiFormatReader
- All Implemented Interfaces:
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.
- Author:
- Sean Owen, dswitkin@google.com (Daniel Switkin)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondecode
(BinaryBitmap image) This version of decode honors the intent of Reader.decode(BinaryBitmap) in that it passes null as a hint to the decoders.decode
(BinaryBitmap image, Map<DecodeHintType, ?> hints) Decode an image using the hints provided.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
(Map<DecodeHintType, ?> hints) This method adds state to the MultiFormatReader.
-
Constructor Details
-
MultiFormatReader
public MultiFormatReader()
-
-
Method Details
-
decode
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 interfaceReader
- Parameters:
image
- The pixel data to decode- Returns:
- The contents of the image
- Throws:
NotFoundException
- Any errors which occurred
-
decode
Decode an image using the hints provided. Does not honor existing state.- Specified by:
decode
in interfaceReader
- Parameters:
image
- The pixel data to decodehints
- The hints to use, clearing the previous state.- Returns:
- The contents of the image
- Throws:
NotFoundException
- Any errors which occurred
-
decodeWithState
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
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.
-