mirror of
https://github.com/zxing/zxing.git
synced 2025-01-13 04:07:27 -08:00
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:
parent
e7dfffc3d0
commit
8a018c8af8
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
|
||||
}
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue