Java 二維碼產生

來源:互聯網
上載者:User
 

原文出處:http://blog.csdn.net/wangpeng047/article/details/7181217 (感謝並尊重原作者)

正常使用下面代碼做需要的jar包,免積分:http://download.csdn.net/detail/zihan11201120/4969485

 1 package com.zihan.org; 2  3 import java.text.DateFormat; 4 import java.text.SimpleDateFormat; 5 import java.util.Date; 6 import qrcode.TwoDimensionCode; 7 public class nihao { 8  9     /**10      * @param args11      * @author ZIHAN12      * @date 2013-1-713      */14     public static void main(String[] args) {15          // TODO Auto-generated method stub16            Date aDate = new Date();17            String string = null;18            DateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddHHmmssSSS");19            string= simpleDateFormat.format(aDate);20          //存放圖片路徑21            String imgPath = "e:/TDDOWNLOAD/Michael_QRCode"+string+".png";22          //二維碼內容 23            String encoderContent = "你好,這是二維碼產生案例";24          //調用TwoDimensionCode25            TwoDimensionCode handler = new TwoDimensionCode();  26            handler.encoderQRCode(encoderContent, imgPath, "png");  27            System.out.println("========encoder success");28          //解析29            String decoderContent = handler.decoderQRCode(imgPath);  30            System.out.println("解析結果如下:");  31            System.out.println(decoderContent);  32         System.out.println("========decoder success!!!"); 33         34     }35 }

 

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.