import java.io.IOException;
import Decoder.BASE64Decoder;
import Decoder.BASE64Encoder;
public class Base {
public static void main(String args[]) throws IOException{
BASE64Decoder decode = new BASE64Decoder();
BASE64Encoder encode = new BASE64Encoder();
String a = "liu";
byte[] b =a.getBytes();
System.out.println(new String(b));
System.out.println("liu转换为字节数组为"+b);
String c = encode.encode(b);
System.out.println("把转换后的字节用base64编码为(String)"+c);
byte[] e = decode.decodeBuffer(c);
System.out.println("在用base64解码为(byte[])"+e);
String d =new String(e);
System.out.println(d);
}
import Decoder.BASE64Decoder;
import Decoder.BASE64Encoder;
public class Base {
public static void main(String args[]) throws IOException{
BASE64Decoder decode = new BASE64Decoder();
BASE64Encoder encode = new BASE64Encoder();
String a = "liu";
byte[] b =a.getBytes();
System.out.println(new String(b));
System.out.println("liu转换为字节数组为"+b);
String c = encode.encode(b);
System.out.println("把转换后的字节用base64编码为(String)"+c);
byte[] e = decode.decodeBuffer(c);
System.out.println("在用base64解码为(byte[])"+e);
String d =new String(e);
System.out.println(d);
}
}
由上面的程序可知:同一个string类型的字符串,对应多个byte[]形式。