|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.glxn.qrgen.QRCode
public class QRCode
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.
Start here: from(String) (e.g QRCode.from("hello"))
| Method Summary | |
|---|---|
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. |
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 cahrset by supplying a EncodeHintType.CHARACTER_SET
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 |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
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 QRCode to(ImageType imageType)
ImageType.PNG
imageType - the ImageType you would like the resulting QR to be
public QRCode withSize(int width,
int height)
width - the width in pixelsheight - the height in pixels
public QRCode withCharset(String charset)
EncodeHintType.CHARACTER_SET
hint to 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 file
file()public ByteArrayOutputStream stream()
ByteArrayOutputStream representation of the QR code
public void writeTo(OutputStream stream)
OutputStream
stream - the OutputStream to write QR Code to
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||