public abstract class AbstractQRCode extends Object
QRCode generator. This is a simple class that is built on top of ZXING
Please take a look at their framework, as it has a lot of features.
This small project is just a wrapper that gives a
convenient interface to work with.
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 |
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 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)
OutputStream
stream
- the OutputStream
to write QR Code toprotected abstract void writeToStream(OutputStream stream) throws IOException, com.google.zxing.WriterException
IOException
com.google.zxing.WriterException
protected com.google.zxing.common.BitMatrix createMatrix(String text) throws com.google.zxing.WriterException
com.google.zxing.WriterException
protected File createTempFile() throws IOException
IOException
protected File createTempFile(String name) throws IOException
IOException
public com.google.zxing.Writer getQrWriter()
public void setQrWriter(com.google.zxing.Writer qrWriter)
Copyright © 2018. All rights reserved.