public class ZxingKit extends Object
| 构造器和说明 |
|---|
ZxingKit() |
| 限定符和类型 | 方法和说明 |
|---|---|
static com.google.zxing.Result |
decode(String srcImgFilePath) |
static boolean |
encode(String contents,
com.google.zxing.BarcodeFormat barcodeFormat,
Integer margin,
com.google.zxing.qrcode.decoder.ErrorCorrectionLevel errorLevel,
String format,
int width,
int height,
String saveImgFilePath)
Zxing图形码生成工具
|
static void |
encodeOutPutSteam(OutputStream outputStream,
String contents,
com.google.zxing.BarcodeFormat barcodeFormat,
Integer margin,
com.google.zxing.qrcode.decoder.ErrorCorrectionLevel errorLevel,
String format,
int width,
int height) |
static void |
main(String[] args) |
static boolean |
writeToFile(BufferedImage bufImg,
String format,
String saveImgFilePath)
将BufferedImage对象写入文件
|
public static boolean encode(String contents, com.google.zxing.BarcodeFormat barcodeFormat, Integer margin, com.google.zxing.qrcode.decoder.ErrorCorrectionLevel errorLevel, String format, int width, int height, String saveImgFilePath)
contents - 内容barcodeFormat - BarcodeFormat对象format - 图片格式,可选[png,jpg,bmp]width - 宽height - 高margin - 边框间距pxsaveImgFilePath - 存储图片的完整位置,包含文件名public static void encodeOutPutSteam(OutputStream outputStream, String contents, com.google.zxing.BarcodeFormat barcodeFormat, Integer margin, com.google.zxing.qrcode.decoder.ErrorCorrectionLevel errorLevel, String format, int width, int height)
outputStream - 可以来自response,也可以来自文件contents - 内容barcodeFormat - BarcodeFormat对象margin - 图片格式,可选[png,jpg,bmp]errorLevel - 纠错级别 一般为:ErrorCorrectionLevel.Hformat - 图片格式,可选[png,jpg,bmp]width - 宽height - 高
eg:
ZxingKit.encodeOutPutSteam(response.getOutputStream(), qrCodeUrl, BarcodeFormat.QR_CODE, 3, ErrorCorrectionLevel.H, "png", 200, 200);public static com.google.zxing.Result decode(String srcImgFilePath)
srcImgFilePath - 要解码的图片地址public static boolean writeToFile(BufferedImage bufImg, String format, String saveImgFilePath)
bufImg - BufferedImage对象format - 图片格式,可选[png,jpg,bmp]saveImgFilePath - 存储图片的完整位置,包含文件名public static void main(String[] args)
Copyright © 2019. All rights reserved.