Changed the Writer interface to provide contents as a String instead of a byte array.

git-svn-id: https://zxing.googlecode.com/svn/trunk@738 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
dswitkin 2008-11-19 20:12:38 +00:00
parent e7dfffc3d0
commit 8a018c8af8
3 changed files with 9 additions and 9 deletions

View file

@ -29,13 +29,13 @@ import java.util.Hashtable;
*/
public final class MultiFormatWriter implements Writer {
public ByteMatrix encode(byte[] contents, BarcodeFormat format, int width,
public ByteMatrix encode(String contents, BarcodeFormat format, int width,
int height) throws WriterException {
return encode(contents, format, width, height, null);
}
public ByteMatrix encode(byte[] contents, BarcodeFormat format, int width, int height,
public ByteMatrix encode(String contents, BarcodeFormat format, int width, int height,
Hashtable hints) throws WriterException {
if (format == BarcodeFormat.QR_CODE) {

View file

@ -30,25 +30,25 @@ public interface Writer {
/**
* Encode a barcode using the default settings.
*
* @param contents The raw contents to encode in the barcode
* @param contents The contents to encode in the barcode
* @param format The barcode format to generate
* @param width The preferred width in pixels
* @param height The preferred height in pixels
* @return The generated barcode as a Matrix of unsigned bytes (0 == black, 255 == white)
*/
ByteMatrix encode(byte[] contents, BarcodeFormat format, int width, int height)
ByteMatrix encode(String contents, BarcodeFormat format, int width, int height)
throws WriterException;
/**
*
* @param contents The raw contents to encode in the barcode
* @param contents The contents to encode in the barcode
* @param format The barcode format to generate
* @param width The preferred width in pixels
* @param height The preferred height in pixels
* @param hints Additional parameters to supply to the encoder
* @return The generated barcode as a Matrix of unsigned bytes (0 == black, 255 == white)
*/
ByteMatrix encode(byte[] contents, BarcodeFormat format, int width, int height, Hashtable hints)
ByteMatrix encode(String contents, BarcodeFormat format, int width, int height, Hashtable hints)
throws WriterException;
}

View file

@ -35,16 +35,16 @@ public final class QRCodeWriter implements Writer {
private static final int QUIET_ZONE_SIZE = 4;
public ByteMatrix encode(byte[] contents, BarcodeFormat format, int width, int height)
public ByteMatrix encode(String contents, BarcodeFormat format, int width, int height)
throws WriterException {
return encode(contents, format, width, height, null);
}
public ByteMatrix encode(byte[] contents, BarcodeFormat format, int width, int height,
public ByteMatrix encode(String contents, BarcodeFormat format, int width, int height,
Hashtable hints) throws WriterException {
if (contents == null || contents.length == 0) {
if (contents == null || contents.length() == 0) {
throw new IllegalArgumentException("Found empty contents");
}