heting

  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理 ::
  40 随笔 :: 9 文章 :: 45 评论 :: 0 Trackbacks
 1  
import sun.misc.BASE64Decoder;
  
public static String getFromBASE64(String s) 
 2        if (s == nullreturn null
 3        BASE64Decoder decoder = new BASE64Decoder(); 
 4        try 
 5        byte[] b = decoder.decodeBuffer(s); 
 6        return new String(b); 
 7        }
 catch (Exception e) 
 8        return null
 9        }
 
10    }

11    public static String getBASE64(String s) 
12        if (s == nullreturn null
13        return (new sun.misc.BASE64Encoder()).encode( s.getBytes() ); 
14    }
 
15    
posted on 2008-11-08 10:47 贺挺 阅读(1595) 评论(0)  编辑  收藏

只有注册用户登录后才能发表评论。


网站导航: