zxing
关于二维码的操作
生成与读取就是使用2个流 MatrixToImageWriter
MultiFormatWriter.encode----->BitMatrix-------------------->BufferedImage
//大小
int width=300;
int height=300;
//内容
String contents = "张三你好";
//参数
HashMap map = new HashMap();
map.put(EncodeHintType.CHARACTER_SET, "utf-8");
map.put(EncodeHintType.MARGIN, 0);
//容错级别
map.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.M);
MultiFormatWriter mfw = new MultiFormatWriter();
BitMatrix bm = mfw.encode(contents, BarcodeFormat.QR_CODE, width, height,map);
// BufferedImage bi = MatrixToImageWriter.toBufferedImage(bm);
// ImageIO.write(bi, "png", new File("xx.png"));
Path path = new File("D:/img.png").toPath();
MatrixToImageWriter.writeToPath(bm, "png", path);
MultiFormatReader.decode
//参数
HashMap map = new HashMap();
map.put(EncodeHintType.CHARACTER_SET, &