Java 二维码封装库 QRGen

码农软件 · 软件分类 · 条形码/二维码 · 2019-10-07 20:58:33

软件介绍

QRGen 是一个简单的 Java 操作二维码的开发库,基于 ZXing 开发,让二维码的操作更加简单。支持 Android。

示例代码:

// get QR file from text using defaults
File file = QRCode.from("Hello World").file();

// get QR stream from text using defaults
ByteArrayOutputStream stream = QRCode.from("Hello World").stream();

// override the image type to be JPG
QRCode.from("Hello World").to(ImageType.JPG).file();
QRCode.from("Hello World").to(ImageType.JPG).stream();

// override image size to be 250x250
QRCode.from("Hello World").withSize(250, 250).file();
QRCode.from("Hello World").withSize(250, 250).stream();

// override size and image type
QRCode.from("Hello World").to(ImageType.GIF).withSize(250, 250).file();
QRCode.from("Hello World").to(ImageType.GIF).withSize(250, 250).stream();

// override default colors (black on white)
// notice that the color format is "0x(alpha: 1 byte)(RGB: 3 bytes)"
// so in the example below it's red for foreground and yellowish for background, both 100% alpha (FF).
QRCode.from("Hello World").withColor(0xFFFF0000, 0xFFFFFFAA).file();

// supply own outputstream
QRCode.from("Hello World").to(ImageType.PNG).writeTo(outputStream);

// supply own file name
QRCode.from("Hello World").file("QRCode");

// supply charset hint to ZXING
QRCode.from("Hello World").withCharset("UTF-8");

// supply error correction level hint to ZXING
QRCode.from("Hello World").withErrorCorrection(ErrorCorrectionLevel.L);

// supply any hint to ZXING
QRCode.from("Hello World").withHint(EncodeHintType.CHARACTER_SET, "UTF-8");

// encode contact data as vcard using defaults
VCard johnDoe = new VCard("John Doe")
                    .setEmail("john.doe@example.org")
                    .setAddress("John Doe Street 1, 5678 Doestown")
                    .setTitle("Mister")
                    .setCompany("John Doe Inc.")
                    .setPhoneNumber("1234")
                    .setWebsite("www.example.org");
QRCode.from(johnDoe).file();

// if using special characters don't forget to supply the encoding
VCard johnSpecial = new VCard("Jöhn Dɵe")
                        .setAddress("ëåäöƞ Sträät 1, 1234 Döestüwn");
QRCode.from(johnSpecial).withCharset("UTF-8").file();

本文地址:https://codercto.com/soft/d/16264.html

社交的本质:扎克伯格的商业秘密

社交的本质:扎克伯格的商业秘密

兰迪•扎克伯格 / 谢天 / 中信出版集团股份有限公司 / 2016-6-1 / CNY 45.00

从发表个人观点到找工作,从交朋友到找伴侣,社会化媒体的广泛应用、互联技术的高速发展已经改变了我们生活的各个领域。 Facebook早期成员之一,兰迪·扎克伯格阐述了社交的本质,并首次披露Facebook的商业策略。她以社交媒体实践者的视角,分享了自己在Facebook负责营销的从业经历与成长故事,以及对互联网和社会未来变化趋势的思考,并给组织和个人提出了解决方案。一起来看看 《社交的本质:扎克伯格的商业秘密》 这本书的介绍吧!

Base64 编码/解码
Base64 编码/解码

Base64 编码/解码

SHA 加密
SHA 加密

SHA 加密工具

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具