乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      微信掃描二維碼跳轉(zhuǎn)頁(yè)面

       Levy_X 2017-10-10

      最近在完成一個(gè)大作業(yè),反正一個(gè)小部分就是掃描二維碼,跳轉(zhuǎn)到一個(gè)界面去,搜網(wǎng)上也沒(méi)有什么太有用的信息,覺(jué)得難死了。。 后來(lái)想想,以前寫(xiě)過(guò)一個(gè)程序,就是把字符串生成相應(yīng)的二維碼,然后我就抱著試試看的心態(tài),把url 放進(jìn)去,掃一下看看,結(jié)果,成功了。。。瞎貓碰著死老鼠,真幸運(yùn)~~

      可以參考我的這篇文章:http://blog.csdn.net/prayallforyou/article/details/51417807

      public class test {

           private static final int BLACK = 0xFF000000;
              private static final int WHITE = 0xFFFFFFFF;
          
              public static void main ( String[] args ) throws Exception
              {
                  String text = 'https://www.baidu.com/'; //這里是URL ,掃描之后就跳轉(zhuǎn)到這個(gè)界面
                  String path = 'D:/'; //圖片生成的位置
                  int width = 900;
                  int height = 900;
                  // 二維碼圖片格式
                  String format = 'gif';
                  // 設(shè)置編碼,防止中文亂碼
                  Hashtable<EncodeHintType, Object> ht = new Hashtable<EncodeHintType, Object> ();
                  ht.put (EncodeHintType.CHARACTER_SET, 'UTF-8');
                  // 設(shè)置二維碼參數(shù)(編碼內(nèi)容,編碼類型,圖片寬度,圖片高度,格式)
                   
                  BitMatrix bitMatrix = new MultiFormatWriter ().encode (text, BarcodeFormat.QR_CODE, width, height, ht);
                  // 生成二維碼(定義二維碼輸出服務(wù)器路徑)
                  File outputFile = new File (path);
                  if (!outputFile.exists ())
                  {
                      //創(chuàng)建文件夾
                      outputFile.mkdir ();
                  }
                  int b_width = bitMatrix.getWidth ();
                  int b_height = bitMatrix.getHeight ();
                  // 建立圖像緩沖器
                  BufferedImage image = new BufferedImage (b_width, b_height, BufferedImage.TYPE_3BYTE_BGR);
                  for ( int x = 0; x < b_width; x )
                  {
                      for ( int y = 0; y < b_height; y )
                      {
                          image.setRGB (x, y, bitMatrix.get (x, y) ? BLACK : WHITE);
                      }
                  }
                  // 生成二維碼
                  ImageIO.write (image, format, new File (path '/erweima.' format)); //二維碼的名稱 是 erweima.sgif
              }
      }







        本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購(gòu)買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
        轉(zhuǎn)藏 分享 獻(xiàn)花(0

        0條評(píng)論

        發(fā)表

        請(qǐng)遵守用戶 評(píng)論公約

        類似文章 更多