TNT blog  
          日歷
          <2025年6月>
          25262728293031
          1234567
          891011121314
          15161718192021
          22232425262728
          293012345
          統計
          • 隨筆 - 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 閱讀(206) 評論(0)  編輯  收藏 所屬分類: JAVA
           
          Copyright © TNT Powered by: 博客園 模板提供:滬江博客
          主站蜘蛛池模板: 年辖:市辖区| 凤凰县| 新民市| 当涂县| 谷城县| 黄石市| 和田市| 郯城县| 安康市| 马公市| 临沭县| 洛阳市| 吉水县| 望城县| 峨眉山市| 抚顺市| 岢岚县| 饶阳县| 延边| 康保县| 阿荣旗| 余庆县| 普陀区| 清河县| 合川市| 大同县| 遵义市| 泰来县| 汉阴县| 冷水江市| 鄂尔多斯市| 玉门市| 长兴县| 息烽县| 乐都县| 翁牛特旗| 醴陵市| 雅江县| 彰化县| 房山区| 科技|