* @return
* @throws Exception
*/
private String readImage(final Exchange exchange, final InputStream stream)
throws Exception {
final MultiFormatReader reader = new MultiFormatReader();
final BufferedInputStream in = exchange.getContext()
.getTypeConverter()
.mandatoryConvertTo(BufferedInputStream.class, stream);
final BinaryBitmap bitmap = new BinaryBitmap(
new HybridBinarizer(
new BufferedImageLuminanceSource(ImageIO.read(in))));
final Result result = reader.decode(bitmap, readerHintMap);
// write the found barcode format into the header
exchange.getOut()
.setHeader(Barcode.BARCODE_FORMAT, result.getBarcodeFormat());