package com.softeem.base64;
import org.apache.commons.codec.binary.Base64;
public class TestBase64 {
//
public String encode(String myStringring){
Base64 base64=new Base64();
byte [] buft=base64.encode(myStringring.getBytes());
return new String(buft);
}
public String decode(String base64String){
Base64 base64=new Base64();
byte[] buft=base64.decode(base64String.getBytes());
return new String(buft);
}
public static void main(String[] args){
TestBase64 test=new TestBase64();
String base=test.encode("中国人");
System.out.println(base);
String base1=test.decode(base);
System.out.println(base1);
}
}
base64编码
最新推荐文章于 2022-06-27 09:55:01 发布