public class CodeQRUtils extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
private static int |
CODE_HEIGHT |
private static int |
CODE_WIDTH |
private int |
codeHeight |
private int |
codeWidth |
private static int |
COLOR_BACKGROUND |
private static int |
COLOR_FRONT |
private int |
colorBackground |
private int |
colorFront |
| 构造器和说明 |
|---|
CodeQRUtils()
Constructors by default value
|
CodeQRUtils(int width,
int height,
Integer color_front,
Integer color_background)
Constructors
|
| 限定符和类型 | 方法和说明 |
|---|---|
private String |
checkCodeText(String codeText)
Check QR code text
|
void |
create2File(String codeText,
String filePath)
Create a QR code and save it to the specified path
|
void |
create2Stream(String codeText,
OutputStream outputStream)
Create QR code and write to stream
|
private BufferedImage |
getBufferedImage(String codeText)
Get bufferedImage by text
|
private static final int CODE_WIDTH
private static final int CODE_HEIGHT
private static final int COLOR_FRONT
private static final int COLOR_BACKGROUND
private int codeWidth
private int codeHeight
private int colorFront
private int colorBackground
public CodeQRUtils(int width,
int height,
Integer color_front,
Integer color_background)
width - Number, if less than or equal to 0 will use the default value of 400.height - Number, if less than or equal to 0 will use the default value of 400.color_front - QR code body color, hexadecimal color, or default black if empty.color_background - Background color, hex color, or default black if empty.public CodeQRUtils()
public void create2File(String codeText, String filePath) throws com.google.zxing.WriterException, IOException
codeText - QR code textfilePath - Specified pathcom.google.zxing.WriterExceptionIOExceptionpublic void create2Stream(String codeText, OutputStream outputStream) throws com.google.zxing.WriterException, IOException
codeText - QR code textoutputStream - streamcom.google.zxing.WriterExceptionIOExceptionprivate String checkCodeText(String codeText)
codeText - private BufferedImage getBufferedImage(String codeText) throws com.google.zxing.WriterException
codeText - textcom.google.zxing.WriterExceptionCopyright © 2022. All rights reserved.