1.base64转byte[]
导包:
import java.util.Base64
转换:
String base64Str = base64的字符串; byte[] bytes = Base64.getDecoder().decode(base64Str.trim());
2.byte[]转base64
Byte[] srcBytes = 字节数组
Base64.getEncoder().encodeToString(srcBytes)
导包:
import java.util.Base64
转换:
String base64Str = base64的字符串; byte[] bytes = Base64.getDecoder().decode(base64Str.trim());
Byte[] srcBytes = 字节数组
Base64.getEncoder().encodeToString(srcBytes)