A BlackBerry® device with a camera can be used as an image or barcode scanner.
The BlackBerry® Java® SDK 6.1 includes ZXing 1.6, an open-source barcode scanning library. You can use the classes found in the com.google.zxing package, in conjunction with the net.rim.device.api.barcodelib package, to scan 1-D and 2-D barcodes.
To scan an image for a barcode, you must construct a BarcodeScanner object, and implement a matching decoder and listener. When the camera detects a barcode, it is passed into a BarcodeDecoder object for decoding, using the ZXing library. After the barcode is decoded, it is passed as raw data into a BarcodeScannerListener object for processing.
When decoding a barcode, you have the option of giving the decoder a set of hints. Hints are constants defined in the ZXing library that narrow down the possible results for the decoder, and improve the speed and accuracy of decoding.
The ZXing library also supports encoding of strings into 2-D barcodes. The MultiFormatWriter class generates a ByteMatrix of black and white pixels. You can create more specific implementations using the Writer interface.