X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=core%2Fsrc%2Fcom%2Fgoogle%2Fzxing%2Fqrcode%2Fdecoder%2FDecoder.java;h=e22fea55ecdf1de9a2e0930fd6acc83f8462fd52;hb=f3880260808aac8cb22f216ec8e5c00e391e13e6;hp=4f73245755bf07b5b702b97e9d944421b3fa846f;hpb=d95e9e95edfccd997a31512973c2d28cd8b9e0c5;p=zxing.git diff --git a/core/src/com/google/zxing/qrcode/decoder/Decoder.java b/core/src/com/google/zxing/qrcode/decoder/Decoder.java index 4f732457..e22fea55 100644 --- a/core/src/com/google/zxing/qrcode/decoder/Decoder.java +++ b/core/src/com/google/zxing/qrcode/decoder/Decoder.java @@ -18,6 +18,7 @@ package com.google.zxing.qrcode.decoder; import com.google.zxing.ReaderException; import com.google.zxing.common.BitMatrix; +import com.google.zxing.common.DecoderResult; import com.google.zxing.common.reedsolomon.GF256; import com.google.zxing.common.reedsolomon.ReedSolomonDecoder; import com.google.zxing.common.reedsolomon.ReedSolomonException; @@ -41,10 +42,10 @@ public final class Decoder { * "true" is taken to mean a black module.

* * @param image booleans representing white/black QR Code modules - * @return text encoded within the QR Code + * @return text and bytes encoded within the QR Code * @throws ReaderException if the QR Code cannot be decoded */ - public String decode(boolean[][] image) throws ReaderException { + public DecoderResult decode(boolean[][] image) throws ReaderException { int dimension = image.length; BitMatrix bits = new BitMatrix(dimension); for (int i = 0; i < dimension; i++) { @@ -61,10 +62,10 @@ public final class Decoder { *

Decodes a QR Code represented as a {@link BitMatrix}. A 1 or "true" is taken to mean a black module.

* * @param bits booleans representing white/black QR Code modules - * @return text encoded within the QR Code + * @return text and bytes encoded within the QR Code * @throws ReaderException if the QR Code cannot be decoded */ - public String decode(BitMatrix bits) throws ReaderException { + public DecoderResult decode(BitMatrix bits) throws ReaderException { // Construct a parser and read version, error-correction level BitMatrixParser parser = new BitMatrixParser(bits); @@ -96,7 +97,8 @@ public final class Decoder { } // Decode the contents of that stream of bytes - return DecodedBitStreamParser.decode(resultBytes, version); + String text = DecodedBitStreamParser.decode(resultBytes, version); + return new DecoderResult(resultBytes, text); } /**