com.ikasoa.rpc.utils.Base64Util Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ikasoa-rpc Show documentation
Show all versions of ikasoa-rpc Show documentation
ikasoa-rpc is a high performance RPC(Remote Procedure Call) framework.
package com.ikasoa.rpc.utils;
import java.util.Base64;
/**
* 编码工具
*
* @author Larry
* @version 0.1
*/
public class Base64Util {
/**
* 编码
*
* @param bstr
* 待编码数据
* @return String 编码后数据
*/
public static String encode(byte[] bstr) {
return Base64.getEncoder().encodeToString(bstr);
}
/**
* 解码
*
* @param str
* 待解码数据
* @return byte[] 解码后数据
*/
public static byte[] decode(String str) {
return Base64.getDecoder().decode(str);
}
}