TNT blog  
          日歷
          <2025年8月>
          272829303112
          3456789
          10111213141516
          17181920212223
          24252627282930
          31123456
          統(tǒng)計(jì)
          • 隨筆 - 5
          • 文章 - 40
          • 評(píng)論 - 7
          • 引用 - 0

          導(dǎo)航

          常用鏈接

          留言簿(2)

          隨筆分類

          隨筆檔案

          文章分類

          文章檔案

          收藏夾

          home

          搜索

          •  

          最新隨筆

          最新評(píng)論

          閱讀排行榜

           
          /**
          ??? * Encode a string using Base64 encoding. Used when storing passwords
          ??? * as cookies.
          ??? *
          ??? * This is weak encoding in that anyone can use the decodeString
          ??? * routine to reverse the encoding.
          ??? *
          ??? * @param str
          ??? * @return String
          ??? */
          ?? public static String encodeString(String str)? {
          ?????? sun.misc.BASE64Encoder encoder = new sun.misc.BASE64Encoder();
          ?????? return encoder.encodeBuffer(str.getBytes()).trim();
          ?? }

          ?? /**
          ??? * Decode a string using Base64 encoding.
          ??? *
          ??? * @param str
          ??? * @return String
          ??? */
          ?? public static String decodeString(String str) {
          ?????? sun.misc.BASE64Decoder dec = new sun.misc.BASE64Decoder();
          ?????? try {
          ?????????? return new String(dec.decodeBuffer(str));
          ?????? } catch (IOException io) {
          ?????????????? throw new RuntimeException(io.getMessage(), io.getCause());
          ?????? }
          ??? }

          posted on 2006-06-01 10:40 TNT 閱讀(208) 評(píng)論(0)  編輯  收藏 所屬分類: JAVA
           
          Copyright © TNT Powered by: 博客園 模板提供:滬江博客
          主站蜘蛛池模板: 县级市| 高清| 阿拉尔市| 平定县| 凤冈县| 买车| 新龙县| 洮南市| 永兴县| 鲜城| 南通市| 乐安县| 平度市| 孙吴县| 新安县| 铅山县| 松原市| 巴林左旗| 周宁县| 镇江市| 察隅县| 班玛县| 汝阳县| 廊坊市| 临澧县| 南康市| 察隅县| 长乐市| 剑阁县| 信阳市| 康马县| 肇州县| 栾川县| 正宁县| 潜山县| 谷城县| 柘城县| 蓬安县| 宜宾市| 紫阳县| 广安市|