Added which format was decoded to the CommandLineRunner output.

git-svn-id: https://zxing.googlecode.com/svn/trunk@459 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
dswitkin 2008-06-20 18:35:42 +00:00
parent ce549d76c3
commit f5fb52c464

View file

@ -17,9 +17,10 @@
package com.google.zxing.client.j2se;
import com.google.zxing.DecodeHintType;
import com.google.zxing.MonochromeBitmapSource;
import com.google.zxing.MultiFormatReader;
import com.google.zxing.ReaderException;
import com.google.zxing.MonochromeBitmapSource;
import com.google.zxing.Result;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
@ -59,7 +60,8 @@ public final class CommandLineRunner {
}
}
private static void decodeOneArgument(String argument, Hashtable<DecodeHintType, Object> hints) throws Exception {
private static void decodeOneArgument(String argument, Hashtable<DecodeHintType, Object> hints)
throws Exception {
File inputFile = new File(argument);
if (inputFile.exists()) {
if (inputFile.isDirectory()) {
@ -94,8 +96,9 @@ public final class CommandLineRunner {
}
try {
MonochromeBitmapSource source = new BufferedImageMonochromeBitmapSource(image);
String result = new MultiFormatReader().decode(source, hints).getText();
System.out.println(uri.toString() + ": " + result);
Result result = new MultiFormatReader().decode(source, hints);
System.out.println(uri.toString() + ": " + result.getText() + " format: " +
result.getBarcodeFormat());
return true;
} catch (ReaderException e) {
System.out.println(uri.toString() + ": No barcode found");