隨筆-50  評論-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 蔣家狂潮 閱讀(204) 評論(0)  編輯  收藏 所屬分類: Basic
          主站蜘蛛池模板: 故城县| 安远县| 海兴县| 华安县| 乌审旗| 湛江市| 八宿县| 富锦市| 兖州市| 班戈县| 玛曲县| 聊城市| 洛扎县| 隆德县| 绥德县| 湄潭县| 马尔康县| 高尔夫| 临潭县| 会东县| 华容县| 商河县| 安平县| 宁强县| 即墨市| 和田县| 沅陵县| 汾阳市| 鲁甸县| 南昌市| 永德县| 西乌珠穆沁旗| 兰考县| 靖远县| 怀化市| 澎湖县| 甘南县| 唐河县| 松阳县| 泸州市| 墨竹工卡县|