隨筆-50  評(píng)論-55  文章-8  trackbacks-0

          JAVA的BASE64編碼與解碼:
          1、編碼:
          publicstaticString getBASE64(String s) {
          if (s == null) returnnull;
          return (new sun.misc.BASE64Encoder()).encode( s.getBytes() );
          }
          2、解碼:
          publicstaticString getFromBASE64(String s) {
          if (s == null) returnnull;
          BASE64Decoder decoder = new BASE64Decoder();
          try {
          byte[] b = decoder.decodeBuffer(s);
          returnnewString(b);
          } catch (Exception e) {
          returnnull;
          }
          }

          posted on 2009-01-06 10:12 蔣家狂潮 閱讀(202) 評(píng)論(0)  編輯  收藏 所屬分類: Basic
          主站蜘蛛池模板: 股票| 满洲里市| 阿图什市| 阿鲁科尔沁旗| 迭部县| 扎兰屯市| 连云港市| 林甸县| 玉溪市| 赤壁市| 囊谦县| 梓潼县| 扶风县| 柘荣县| 丰台区| 宾川县| 南乐县| 鄂尔多斯市| 芒康县| 长泰县| 长治市| 岗巴县| 图们市| 平遥县| 汝州市| 定西市| 晋城| 清丰县| 麻栗坡县| 民县| 崇州市| 邢台市| 新乐市| 诏安县| 蒙城县| 郑州市| 上蔡县| 京山县| 遂溪县| 嘉禾县| 吉安县|