public class QRCodeHelper extends Object
Modifier and Type | Method and Description |
---|---|
static QRCodeHelper |
create(String content,
int width,
int height) |
static QRCodeHelper |
create(String content,
int width,
int height,
com.google.zxing.qrcode.decoder.ErrorCorrectionLevel level) |
static QRCodeHelper |
create(String content,
int width,
int height,
int margin,
com.google.zxing.qrcode.decoder.ErrorCorrectionLevel level) |
static QRCodeHelper |
create(String content,
String characterSet,
int width,
int height,
int margin,
com.google.zxing.qrcode.decoder.ErrorCorrectionLevel level) |
String |
getFormat() |
QRCodeHelper |
setFormat(String format) |
QRCodeHelper |
setLogo(BufferedImage logoImage,
int logoImageSize,
int borderWidth,
Color borderColor,
Color backgroundColor) |
QRCodeHelper |
setLogo(File logoFile,
int logoImageSize,
int borderWidth,
Color borderColor,
Color backgroundColor) |
QRCodeHelper |
setLogo(ImageInputStream logoImageInputStream,
int logoImageSize,
int borderWidth,
Color borderColor,
Color backgroundColor) |
QRCodeHelper |
setLogo(InputStream logoInputStream,
int logoImageSize,
int borderWidth,
Color borderColor,
Color backgroundColor) |
QRCodeHelper |
setLogo(URL logoUrl,
int logoImageSize,
int borderWidth,
Color borderColor,
Color backgroundColor) |
BufferedImage |
toBufferedImage() |
void |
writeToFile(File file)
输出二维码图片到文件
|
void |
writeToStream(OutputStream stream)
输出二维码图片到输出流
|
public static QRCodeHelper create(String content, String characterSet, int width, int height, int margin, com.google.zxing.qrcode.decoder.ErrorCorrectionLevel level) throws com.google.zxing.WriterException
content
- 二维码内容字符串characterSet
- 使用的字符编码集,默认UTF-8width
- 二维码图片宽度height
- 二维码图片高度margin
- 二维码图片边距,默认3level
- 二维码容错级别com.google.zxing.WriterException
- 可能产生异常public static QRCodeHelper create(String content, int width, int height, int margin, com.google.zxing.qrcode.decoder.ErrorCorrectionLevel level) throws com.google.zxing.WriterException
com.google.zxing.WriterException
public static QRCodeHelper create(String content, int width, int height, com.google.zxing.qrcode.decoder.ErrorCorrectionLevel level) throws com.google.zxing.WriterException
content
- 二维码内容字符串width
- 二维码图片宽度height
- 二维码图片高度level
- 二维码容错级别com.google.zxing.WriterException
- 可能产生的异常public static QRCodeHelper create(String content, int width, int height) throws com.google.zxing.WriterException
content
- 二维码内容字符串width
- 二维码图片宽度height
- 二维码图片高度com.google.zxing.WriterException
- 可能产生的异常public QRCodeHelper setFormat(String format)
format
- 图片格式public QRCodeHelper setLogo(InputStream logoInputStream, int logoImageSize, int borderWidth, Color borderColor, Color backgroundColor) throws IOException
IOException
public QRCodeHelper setLogo(File logoFile, int logoImageSize, int borderWidth, Color borderColor, Color backgroundColor) throws IOException
IOException
public QRCodeHelper setLogo(URL logoUrl, int logoImageSize, int borderWidth, Color borderColor, Color backgroundColor) throws IOException
IOException
public QRCodeHelper setLogo(ImageInputStream logoImageInputStream, int logoImageSize, int borderWidth, Color borderColor, Color backgroundColor) throws IOException
IOException
public QRCodeHelper setLogo(BufferedImage logoImage, int logoImageSize, int borderWidth, Color borderColor, Color backgroundColor)
public BufferedImage toBufferedImage()
public String getFormat()
public void writeToFile(File file) throws IOException
file
- 目标文件对象IOException
- 可能产生的异常public void writeToStream(OutputStream stream) throws IOException
stream
- 目标输出流对象IOException
- 可能产生的异常Copyright © 2022. All rights reserved.