X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=zxingorg%2Fweb%2Fdecoderesult.jspx;h=658cca1e1d53d4c772f5af349145581f065cafd8;hb=0e6081d08b35993a92025bc95a1f49c211532f52;hp=833d6bf7e1a504f12f52bc4a14775dd1e5e22715;hpb=766b8a4440e81a38c6889b2933263bf9f4e2bfa6;p=zxing.git diff --git a/zxingorg/web/decoderesult.jspx b/zxingorg/web/decoderesult.jspx index 833d6bf7..658cca1e 100644 --- a/zxingorg/web/decoderesult.jspx +++ b/zxingorg/web/decoderesult.jspx @@ -14,52 +14,104 @@ See the License for the specific language governing permissions and limitations under the License. --> - - - - - response.setHeader("Cache-Control", "no-cache"); - - - - - - - - Decode Succeeded - - - -

Decode Succeeded

- - - - - - - - - - - - - - - - - - - - - -
Raw text${text}
Raw bytes${rawBytesString}
Barcode format${result.barcodeFormat}
Parsed Result Type${parsedReaderResult.type}
Parsed Result${displayResult}
-

Copyright 2008 ZXing authors

- - - + + + + + private static String arrayToString(byte[] bytes) { + int length = bytes.length; + StringBuilder result = new StringBuilder(length << 2); + int i = 0; + while (i < length) { + int max = Math.min(i + 8, length); + for (int j = i; j < max; j++) { + int value = bytes[j] & 0xFF; + result.append(Integer.toHexString(value / 16)); + result.append(Integer.toHexString(value % 16)); + result.append(' '); + } + result.append('\n'); + i += 8; + } + for (int j = i - 8; j < length; j++) { + result.append(Integer.toHexString(bytes[j] & 0xFF)); + result.append(' '); + } + return result.toString(); + } + + +response.setHeader("Cache-Control", "no-cache"); +]]> + + + Decode Succeeded + + + + + + + for (Result result : (List<Result>) request.getAttribute("results")) { + ParsedResult parsedResult = ResultParser.parseResult(result); + + String text = result.getText(); + if (text == null) { + text = "(Not applicable)"; + } else { + text = StringEscapeUtils.escapeXml(text); + } + + byte[] rawBytes = result.getRawBytes(); + String rawBytesString; + if (rawBytes == null) { + rawBytesString = "(Not applicable)"; + } else { + rawBytesString = arrayToString(rawBytes); + } + + String displayResult = parsedResult.getDisplayResult(); + if (displayResult == null) { + displayResult = "(Not applicable)"; + } else { + displayResult = StringEscapeUtils.escapeXml(displayResult); + } + + + + + + + + + + + + + + + + + + + + + + +
Raw texttext
Raw bytesrawBytesString
Barcode formatresult.getBarcodeFormat()
Parsed Result TypeparsedResult.getType()
Parsed ResultdisplayResult
+
+ + } + + + + +