public class QRCode extends Object
from(String) (e.g QRCode.from("hello"))| Modifier and Type | Method and Description |
|---|---|
File |
file()
returns a
File representation of the QR code. |
File |
file(String name)
returns a
File representation of the QR code. |
static QRCode |
from(String text)
Create a QR code from the given text.
|
static QRCode |
from(VCard vcard)
Creates a a QR Code from the given
VCard. |
ByteArrayOutputStream |
stream()
returns a
ByteArrayOutputStream representation of the QR code |
QRCode |
to(ImageType imageType)
Overrides the imageType from its default
ImageType.PNG |
QRCode |
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) |
QRCode |
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) |
QRCode |
withHint(com.google.zxing.EncodeHintType hintType,
Object value)
Sets hint to
QRCodeWriter.encode(java.lang.String, com.google.zxing.BarcodeFormat, int, int) |
QRCode |
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 |
public static QRCode from(String text)
to(net.glxn.qrgen.image.ImageType) e.g. QRCode.from("hello world").to(JPG) withSize(int, int) e.g. QRCode.from("hello world").to(JPG).withSize(125, 125) text - the text to encode to a new QRCode, this may fail if the text is too large. public static QRCode from(VCard vcard)
VCard.
The QRCode will have the following defaults: vcard - the vcard to encode as QRCodepublic QRCode to(ImageType imageType)
ImageType.PNGimageType - the ImageType you would like the resulting QR to bepublic QRCode withSize(int width, int height)
width - the width in pixelsheight - the height in pixelspublic QRCode withCharset(String charset)
EncodeHintType.CHARACTER_SET hint to QRCodeWriter.encode(java.lang.String, com.google.zxing.BarcodeFormat, int, int)public QRCode 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 QRCode withHint(com.google.zxing.EncodeHintType hintType, Object value)
QRCodeWriter.encode(java.lang.String, com.google.zxing.BarcodeFormat, int, int)public 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 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 toCopyright © 2014. All Rights Reserved.