public abstract class AbstractQRCode extends Object
AbstractQRCode#from(String) (e.g QRCode.from("hello"))| Modifier and Type | Field and Description |
|---|---|
protected int |
height |
protected HashMap<com.google.zxing.EncodeHintType,Object> |
hints |
protected ImageType |
imageType |
protected com.google.zxing.Writer |
qrWriter |
protected int |
width |
| Constructor and Description |
|---|
AbstractQRCode() |
| Modifier and Type | Method and Description |
|---|---|
protected com.google.zxing.common.BitMatrix |
createMatrix(String text) |
protected File |
createTempFile() |
protected File |
createTempFile(String name) |
abstract File |
file()
returns a
File representation of the QR code. |
abstract File |
file(String name)
returns a
File representation of the QR code. |
com.google.zxing.Writer |
getQrWriter() |
void |
setQrWriter(com.google.zxing.Writer qrWriter) |
ByteArrayOutputStream |
stream()
returns a
ByteArrayOutputStream representation of the QR code |
AbstractQRCode |
to(ImageType imageType)
Overrides the imageType from its default
ImageType.PNG |
AbstractQRCode |
withCharset(String charset)
Overrides the default charset by supplying a
EncodeHintType.CHARACTER_SET hint to QRCodeWriter.encode(java.lang.String, com.google.zxing.BarcodeFormat, int, int) |
AbstractQRCode |
withErrorCorrection(com.google.zxing.qrcode.decoder.ErrorCorrectionLevel level)
Overrides the default error correction by supplying a
EncodeHintType.ERROR_CORRECTION hint to
QRCodeWriter.encode(java.lang.String, com.google.zxing.BarcodeFormat, int, int) |
AbstractQRCode |
withHint(com.google.zxing.EncodeHintType hintType,
Object value)
Sets hint to
QRCodeWriter.encode(java.lang.String, com.google.zxing.BarcodeFormat, int, int) |
AbstractQRCode |
withSize(int width,
int height)
Overrides the size of the qr from its default 125x125
|
void |
writeTo(OutputStream stream)
writes a representation of the QR code to the supplied
OutputStream |
protected abstract void |
writeToStream(OutputStream stream) |
protected com.google.zxing.Writer qrWriter
protected int width
protected int height
protected ImageType imageType
public AbstractQRCode to(ImageType imageType)
ImageType.PNGimageType - the ImageType you would like the resulting QR to bepublic AbstractQRCode withSize(int width, int height)
width - the width in pixelsheight - the height in pixelspublic AbstractQRCode withCharset(String charset)
EncodeHintType.CHARACTER_SET hint to QRCodeWriter.encode(java.lang.String, com.google.zxing.BarcodeFormat, int, int)public AbstractQRCode withErrorCorrection(com.google.zxing.qrcode.decoder.ErrorCorrectionLevel level)
EncodeHintType.ERROR_CORRECTION hint to
QRCodeWriter.encode(java.lang.String, com.google.zxing.BarcodeFormat, int, int)public AbstractQRCode withHint(com.google.zxing.EncodeHintType hintType, Object value)
QRCodeWriter.encode(java.lang.String, com.google.zxing.BarcodeFormat, int, int)public abstract File file()
File representation of the QR code. The file is set to be deleted on exit (i.e. File.deleteOnExit()). If you want the file to live beyond the life of the jvm process, you should make a copy.public abstract File file(String name)
File representation of the QR code. The file has the given name. The file is set to be deleted on exit
(i.e. File.deleteOnExit()). If you want the file to live beyond the life of the jvm process, you should
make a copy.name - name of the created filefile()public ByteArrayOutputStream stream()
ByteArrayOutputStream representation of the QR codepublic void writeTo(OutputStream stream)
OutputStreamstream - the OutputStream to write QR Code toprotected abstract void writeToStream(OutputStream stream) throws IOException, com.google.zxing.WriterException
IOExceptioncom.google.zxing.WriterExceptionprotected com.google.zxing.common.BitMatrix createMatrix(String text) throws com.google.zxing.WriterException
com.google.zxing.WriterExceptionprotected File createTempFile() throws IOException
IOExceptionprotected File createTempFile(String name) throws IOException
IOExceptionpublic com.google.zxing.Writer getQrWriter()
public void setQrWriter(com.google.zxing.Writer qrWriter)
Copyright © 2014. All Rights Reserved.