ErrorCorrectionLevel; /** * 二维码工具类 * */ public class QRCodeUtil { private static final String CHARSET = "utf-8"; private static final String FORMAT_NAME = "JPG"; private static final int QRCODE_SIZE = 300;// 二维码尺寸 private static final int WIDTH = 60;// LOGO宽度 private ...
BitMatrix bitMatrix = new MultiFormatWriter().encode(content,//要编码的内容 //编码类型,目前zxing支持:Aztec 2D,CODABAR 1D format,Code 39 1D,Code 93 1D ,Code 128 1D, //Data Matrix 2D , EAN-8 1D,EAN-13 1D,ITF (Interleaved Two of Five) 1D, //MaxiCode 2D barcode,PDF417,QR Code 2D,RSS...
Among them, the code correction problem (CRP) requests a student to correct a given source code that have intentionally injected errors, so that it can pass the unit test on JUnit using test code that describes the specifications of the code such as names and data types of classes, methods...
public static void createCodeToFile(String content, File codeImgFileSaveDir, String fileName) { try { if (StringUtils.isBlank(content) || StringUtils.isBlank(fileName)) { return; } content = content.trim(); if (codeImgFileSaveDir==null || codeImgFileSaveDir.isFile()) { //二维码图片存...
ErrorCorrectionLevel; /** * 生成二维码 */ public class QrCodeUtil { private static final int BLACK = 0xFF000000; private static final int WHITE = 0xFFFFFFFF; private static final int margin = 0; private static final int LogoPart = 4; public static void main(String[] args) throws ...
importcom.google.zxing.qrcode.decoder.ErrorCorrectionLevel;publicclassBarcodeGenerator{publicstaticvoidmain(String[]args){intwidth=300;intheight=100;Stringformat="png";Stringcontent="1234567890";// 设置二维码的参数HashMap<EncodeHintType,Object>hints=newHashMap<>();hints.put(EncodeHintType.CHARACTER_SET...
2、调用LoginService的generateGoogleAuthQRCode方法生成二维码 3、使用手机打开Google Authenticator扫描该二维码进行绑定,绑定后会每隔30秒生成一次6位动态验证码 4、调用LoginService的login方法进行登录(需传入手机上显示的6位动态验证码,否则校验不被通过)
hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H);//PDF417Writer pdf417Writer = new PDF417Writer();//长二维码BitMatrix m = getBCode(result, 504, 156,hints); System.out.println("---m.width:"+m.getWidth());//正方形二维码//BitMatrix m = getQCode(result,size);BitMatrix...
1importcom.google.zxing.*;2importcom.google.zxing.client.j2se.BufferedImageLuminanceSource;3importcom.google.zxing.common.BitMatrix;4importcom.google.zxing.common.HybridBinarizer;5importcom.google.zxing.qrcode.decoder.ErrorCorrectionLevel;6importjp.sourceforge.qrcode.util.Color;78importjavax.imageio.Imag...
* @return 生成二维码结果(true or false)*/publicstaticbooleanencodeQRCodeImage(Stringcontent,String...