String与Bas64互转

byte[] encode =  byte[] encode = Base64.getEncoder().encode("http://127.0.0.1/index.html".getBytes());
System.out.println(new String(encode));

byte[] decode1 = Base64.getDecoder().decode(new String(encode));
byte[] decode2 = Base64.getDecoder().decode(encode);
System.out.println(new String(decode1));
System.out.println(new String(decode2));
posted @ 2022-09-23 10:25  云村的王子  阅读(13)  评论(0编辑  收藏  举报  来源