public static void main(String[] args) {
String imgPath = "E:/5.jpg";
String encoderContent = "试试";
//String content="E:/5.jpg";
TwoDimensionCode handler = new TwoDimensionCode();
handler.encoderQRCode(encoderContent, imgPath, "png");
/*try {
OutputStream output = new FileOutputStream(imgPath);
handler.encoderQRCode(content, output);
} catch (Exception e) {
e.printStackTrace();
}*/
System.out.println("========encoder success");
String decoderContent = handler.decoderQRCode(imgPath);
System.out.println("解析结果如下:");
System.out.println(decoderContent);
System.out.println("========decoder success!!!");
}
}
TwoDimensionCodeImage.java
package com.QRCode.demo;
import java.awt.image.BufferedImage;
import jp.sourceforge.qrcode.data.QRCodeImage;
public class TwoDimensionCodeImage implements QRCodeImage {