From 76eeeed99a68d47a58a72ff08af243b60babde3b Mon Sep 17 00:00:00 2001 From: srowen Date: Mon, 11 May 2009 21:51:20 +0000 Subject: [PATCH] Add toString() for easy debugging git-svn-id: https://zxing.googlecode.com/svn/trunk@939 59b500cc-1b3d-0410-9834-0bbf25fbcc57 --- .../zxing/common/BaseMonochromeBitmapSource.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/core/src/com/google/zxing/common/BaseMonochromeBitmapSource.java b/core/src/com/google/zxing/common/BaseMonochromeBitmapSource.java index 0a99cda2b..35c3f2642 100644 --- a/core/src/com/google/zxing/common/BaseMonochromeBitmapSource.java +++ b/core/src/com/google/zxing/common/BaseMonochromeBitmapSource.java @@ -161,6 +161,20 @@ public abstract class BaseMonochromeBitmapSource implements MonochromeBitmapSour return width; } + public String toString() { + StringBuffer result = new StringBuffer(height * (width + 1)); + BitArray row = new BitArray(width); + for (int i = 0; i < height; i++) { + row = getBlackRow(i, row, 0, width); + for (int j = 0; j < width; j++) { + result.append(row.get(j) ? "X " : " "); + } + result.append('\n'); + } + return result.toString(); + } + + // These methods below should not need to exist because they are defined in the interface that // this abstract class implements. However this seems to cause problems on some Nokias. // So we write these redundant declarations.