public class QrCodeKit extends Object
IJPay 让支付触手可及,封装了微信支付、支付宝支付、银联支付常用的支付方式以及各种常用的接口。
不依赖任何第三方 mvc 框架,仅仅作为工具使用简单快速完成支付模块的开发,可轻松嵌入到任何系统里。
IJPay 交流群: 723992875
Node.js 版: https://gitee.com/javen205/TNWX
google 开源图形码工具类
Constructor and Description |
---|
QrCodeKit() |
Modifier and Type | Method and Description |
---|---|
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)
图形码生成工具
|
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) throws IOException
outputStream
- 可以来自response,也可以来自文件contents
- 内容barcodeFormat
- BarcodeFormat对象margin
- 图片格式,可选[png,jpg,bmp]errorLevel
- 纠错级别 一般为:ErrorCorrectionLevel.Hformat
- 图片格式,可选[png,jpg,bmp]width
- 宽height
- 高IOException
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 © 2022. All rights reserved.