public class QRCode extends AbstractQRCode
| Modifier and Type | Field and Description |
|---|---|
static com.google.zxing.client.j2se.MatrixToImageConfig |
DEFAULT_CONFIG |
protected com.google.zxing.client.j2se.MatrixToImageConfig |
matrixToImageConfig |
protected String |
text |
| Modifier and Type | Method and Description |
|---|---|
File |
file() |
File |
file(String name) |
static QRCode |
from(Schema schema)
Creates a a QR Code from the given
Schema. |
static QRCode |
from(String text)
Create a QR code from the given text.
|
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 |
withColor(int onColor,
int offColor) |
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
|
protected void |
writeToStream(OutputStream stream) |
createMatrix, createTempFile, createTempFile, getQrWriter, setQrWriter, stream, writeTopublic static final com.google.zxing.client.j2se.MatrixToImageConfig DEFAULT_CONFIG
protected final String text
protected com.google.zxing.client.j2se.MatrixToImageConfig matrixToImageConfig
protected QRCode(String text)
public static QRCode from(String text)
There is a size limitation to how much you can put into a QR code. This has been tested to work with up to a length of
2950
characters.
The QRCode will have the following defaults:
{size: 100x100}
{imageType:PNG}
to(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(Schema schema)
Schema.
The QRCode will have the following defaults:
{size: 100x100}
{imageType:PNG}
schema - the schema 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)charset - the charset as string, e.g. UTF-8public 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)level - the error correction level to use by 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)hintType - the hintType to setvalue - the concrete value to setpublic File file()
file in class AbstractQRCodepublic File file(String name)
file in class AbstractQRCodeprotected void writeToStream(OutputStream stream) throws IOException, com.google.zxing.WriterException
writeToStream in class AbstractQRCodeIOExceptioncom.google.zxing.WriterExceptionpublic QRCode withColor(int onColor, int offColor)
Copyright © 2018. All rights reserved.