/* JAVA 8 */ package file; import java.io.UnsupportedEncodingException; import java.util.*; public class Base64 { public static void main(String[] args) throws UnsupportedEncodingException { final java.util.Base64.Decoder decoder = java.util.Base64.getDecoder(); final java.util.Base64.Encoder encoder = java.util.Base64.getEncoder(); final String text = "用来测试的文字"; final byte[] textbyte = text.getBytes("UTF-8"); final String encodedText = encoder.encodeToString(textbyte); System.out.println("加密之后:" + encodedText); final String decodedtext = new String(decoder.decode(encodedText),"UTF-8"); System.out.println("重新解密之后: "+decodedtext); } }
Base64
最新推荐文章于 2025-07-02 20:33:18 发布
