Java二维码的生成与解析代码(5)

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 {

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/7bfa20138cd64f670a1ba55167e3e744.html