public class QRCode extends AbstractQRCode
| 限定符和类型 | 字段和说明 |
|---|---|
static com.google.zxing.client.j2se.MatrixToImageConfig |
DEFAULT_CONFIG |
protected com.google.zxing.client.j2se.MatrixToImageConfig |
matrixToImageConfig |
protected String |
text |
| 限定符和类型 | 方法和说明 |
|---|---|
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(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()
AbstractQRCodeFile 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.file 在类中 AbstractQRCodepublic File file(String name)
AbstractQRCodeFile 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.file 在类中 AbstractQRCodename - name of the created fileAbstractQRCode.file()protected void writeToStream(OutputStream stream) throws IOException, com.google.zxing.WriterException
writeToStream 在类中 AbstractQRCodeIOExceptioncom.google.zxing.WriterExceptionpublic QRCode withColor(int onColor, int offColor)
Copyright © 2019. All rights reserved.