Base64编码和解码字符串
package com.example.core.mydemo.cpic; import org.apache.commons.codec.binary.Base64; /** * strEncode=aGVsbG8gd29ybGQ= * strDecode=hello world */ public class BizRequestBase64Test { private static final String CHAR_SET_UTF_8 = "UTF-8"; public static void main(String[] args) throws Exception{ String str = "hello world"; String strEncode = new Base64().encodeToString(str.getBytes(CHAR_SET_UTF_8)); System.out.println("strEncode=" + strEncode); byte[] biz_request = new Base64().decode(strEncode.getBytes(CHAR_SET_UTF_8)); System.out.println("strDecode=" + new String(biz_request)); } }
标签:编码,SET,UTF,String,解码,Base64,strEncode,CHAR From: https://www.cnblogs.com/oktokeep/p/17517623.html