提交 7581798e 编写于 作者: 如梦技术's avatar 如梦技术 🐛

📝 mica-qrcode 添加 base64 image 方法。

上级 9c14e094
VERSION=2.4.4-GA
VERSION=2.4.5-SNAPSHOT
GROUPID=net.dreamlu
SONAR_TOKEN=***
......
......@@ -24,6 +24,7 @@ import com.google.zxing.common.HybridBinarizer;
import com.google.zxing.qrcode.QRCodeReader;
import com.google.zxing.qrcode.QRCodeWriter;
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
import net.dreamlu.mica.core.utils.Base64Util;
import net.dreamlu.mica.core.utils.CharPool;
import net.dreamlu.mica.core.utils.Exceptions;
import net.dreamlu.mica.core.utils.ImageUtil;
......@@ -366,6 +367,15 @@ public final class QrCode {
return qrCodeFile;
}
/**
* 使用带默认值的「QrCode 生成器格式」,把指定的内容生成为一个 QrCode 的 base64 image。
*
* @return base64 字符串
*/
public String toBase64() {
return "data:image/png;base64," + Base64Util.encodeToString(toBytes());
}
/**
* 使用带默认值的「QrCode 生成器格式」,把指定的内容生成为一个 QrCode 的 byte 数组。
*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册