Changed the Writer interface to provide contents as a String instead of a byte array.
authordswitkin <dswitkin@59b500cc-1b3d-0410-9834-0bbf25fbcc57>
Wed, 19 Nov 2008 20:12:38 +0000 (20:12 +0000)
committerdswitkin <dswitkin@59b500cc-1b3d-0410-9834-0bbf25fbcc57>
Wed, 19 Nov 2008 20:12:38 +0000 (20:12 +0000)
git-svn-id: http://zxing.googlecode.com/svn/trunk@738 59b500cc-1b3d-0410-9834-0bbf25fbcc57

core/src/com/google/zxing/MultiFormatWriter.java
core/src/com/google/zxing/Writer.java
core/src/com/google/zxing/qrcode/QRCodeWriter.java

index a57ea7b..5577587 100644 (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) {
index 936f1dd..221d5ad 100644 (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;
 
 }
index 24004e0..b7ff1f0 100644 (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");
     }