Add toString() for easy debugging

git-svn-id: https://zxing.googlecode.com/svn/trunk@939 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
srowen 2009-05-11 21:51:20 +00:00
parent 6d472ea18a
commit 76eeeed99a

View file

@ -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.