实例一
public static void main(String[] args) throws Exception {
String str = “床前明月光,疑是地上霜。举头望明月,低头思故乡。”;
String base64_1 = Base64.getEncoder().encodeToString(str.getBytes("utf-8"));
System.out.println(base64_1);
System.out.println("*******");
String base64_2 = Base64.getMimeEncoder().encodeToString(str.getBytes("utf-8"));
System.out.println(base64_2);
System.out.println("*******");
Decoder decoder = Base64.getMimeDecoder();
byte[] bs_1 = decoder.decode(base64_1);
System.out.println(new String(bs_1, "utf-8"));
System.out.println("*******");
byte[] bs_2 = decoder.decode(base64_2);
System.out.println(new String(bs_2, "utf-8"));
}