TNT blog  
          日歷
          <2025年8月>
          272829303112
          3456789
          10111213141516
          17181920212223
          24252627282930
          31123456
          統計
          • 隨筆 - 5
          • 文章 - 40
          • 評論 - 7
          • 引用 - 0

          導航

          常用鏈接

          留言簿(2)

          隨筆分類

          隨筆檔案

          文章分類

          文章檔案

          收藏夾

          home

          搜索

          •  

          最新隨筆

          最新評論

          閱讀排行榜

           
          /**
          ??? * 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 閱讀(207) 評論(0)  編輯  收藏 所屬分類: JAVA
           
          Copyright © TNT Powered by: 博客園 模板提供:滬江博客
          主站蜘蛛池模板: 呼伦贝尔市| 东兴市| 乐至县| 华亭县| 城步| 牡丹江市| 和田县| 无锡市| 达孜县| 芦山县| 永丰县| 双流县| 蕲春县| 武陟县| 赣州市| 石台县| 临清市| 浙江省| 额敏县| 西吉县| 铜梁县| 西丰县| 汉沽区| 蓝田县| 西乌珠穆沁旗| 镇坪县| 闵行区| 班戈县| 固安县| 云梦县| 台北市| 新乡县| 波密县| 偏关县| 靖江市| 仙游县| 原阳县| 建瓯市| 桐城市| 阜平县| 山阳县|