关于页面乱码的解决使用sun.misc.BASE64Decoder;

关于页面乱码的解决使用sun.misc.BASE64Decoder;
 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     

你可能感兴趣的:(关于页面乱码的解决使用sun.misc.BASE64Decoder;)