import org.apache.commons.codec.binary.Base64;
public class c {
public static void main(String[] args) throws Exception {
// String base64Str =
// "UEsDBC0AAAAIAAaPJkfS5clx//8JABQARW1wbG95ZWVzAQAQAM4BAAAAAAAAmgAAAAAAAACLrlZyKS2pVLJSetqz+/mU+Uo6Sp4uSlamhjpKXvmZeS6JJalAuRh9EEPD0MjCzMzEAAK0DSwMDDRj9IE6fFITy1IhSvNKc3J0lPwSc0Hanu5Z8GRHJ1BBZrFjSkpqipJVWmJOcWqtDg5Ljahh6bO5fU9nzybeUmMcllqaGJhYEGvp877uJ7um4LO0uBhmoQk1fJmWloJpWywAUEsBAjMALQAAAAgABo8mR9LlyXH//wkAFAAAAAAAAAAAAAAAAAAAAEVtcGxveWVlcwEAEADOAQAAAAAAAJoAAAAAAAAAUEsFBgAAAAABAAEASwAAANUAAAAAAA==";
// BASE64Decoder decoder = new BASE64Decoder();
// byte[] b = decoder.decodeBuffer(base64Str); //解码
// String result = decompressByteArrayToString(b, "UTF-8");
// System.out.println(result);
String baseString = Base64.encodeBase64String("我爱中国".getBytes("UTF-8"));
System.out.println("\"我爱中国\"的Base64编码为:" + baseString);
String base64Str = "5oiR54ix5Lit5Zu9";
byte[] bytes = Base64.decodeBase64(base64Str);
System.out.println("解码后:" + new String(bytes, "UTF-8"));
}
}
开心洋葱 , 版权所有丨如未注明 , 均为原创丨未经授权请勿修改 , 转载请注明一个字符串base64解码后再zip解压!