TNT blog  
          日歷
          <2025年6月>
          25262728293031
          1234567
          891011121314
          15161718192021
          22232425262728
          293012345
          統(tǒng)計(jì)
          • 隨筆 - 5
          • 文章 - 40
          • 評論 - 7
          • 引用 - 0

          導(dǎo)航

          常用鏈接

          留言簿(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 閱讀(205) 評論(0)  編輯  收藏 所屬分類: JAVA
           
          Copyright © TNT Powered by: 博客園 模板提供:滬江博客
          主站蜘蛛池模板: 吉水县| 广宗县| 桓台县| 夏津县| 明星| 信丰县| 米易县| 泽普县| 淄博市| 清流县| 溆浦县| 潍坊市| 扶余县| 任丘市| 桃园县| 兰州市| 贡觉县| 潍坊市| 赣州市| 芷江| 廉江市| 合肥市| 柳林县| 浦县| 东山县| 台南县| 巫溪县| 北宁市| 前郭尔| 金寨县| 锦屏县| 中西区| 乡城县| 东辽县| 武夷山市| 雅江县| 桐柏县| 乃东县| 芦山县| 聂荣县| 温泉县|