public class QrCodeHandler extends Object
| 构造器和说明 |
|---|
QrCodeHandler() |
| 限定符和类型 | 方法和说明 |
|---|---|
private static String |
checkCodeText(String codeText)
Check QR code text
|
static String |
createQrCode2File(String codeText,
String savePath,
QrConfig config)
Create a QR code and save it to the specified path
|
static void |
createQrCode2Stream(String codeText,
OutputStream outputStream,
QrConfig config)
Create QR code and write to stream
|
static String |
decodeQrCode2Txt(String qrCodePath)
Scan qrcode file and return text
|
private static BufferedImage |
encodeQrCode(String codeText,
QrConfig config)
Encode text to BufferedImage
|
private static File |
getFile(String filePath)
Get qrcode file
|
public static String createQrCode2File(String codeText, String savePath, QrConfig config) throws com.google.zxing.WriterException, IOException
codeText - QR code textsavePath - Save pathcom.google.zxing.WriterExceptionIOExceptionpublic static void createQrCode2Stream(String codeText, OutputStream outputStream, QrConfig config) throws com.google.zxing.WriterException, IOException
codeText - QR code textoutputStream - streamcom.google.zxing.WriterExceptionIOExceptionpublic static String decodeQrCode2Txt(String qrCodePath)
qrCodePath - qrcode file pathprivate static String checkCodeText(String codeText)
codeText - private static BufferedImage encodeQrCode(String codeText, QrConfig config)
codeText - Copyright © 2022. All rights reserved.