All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.ikasoa.rpc.utils.Base64Util Maven / Gradle / Ivy

There is a newer version: 0.3.3-BETA3
Show newest version
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);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy