com.github.shoothzj.javatool.util.Base64Util Maven / Gradle / Ivy
The newest version!
package com.github.shoothzj.javatool.util;
import java.nio.charset.StandardCharsets;
import java.util.Base64;
/**
* @author hezhangjian
*/
public class Base64Util {
private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(Base64Util.class);
public static String encodeToString(byte[] array) {
return new String(encode(array), StandardCharsets.UTF_8);
}
public static byte[] encode(byte[] array) {
return Base64.getEncoder().encode(array);
}
}