import java.io.IOException;
import sun.misc.BASE64Decoder;
/**
* BASE64
* @author ysl
*
*/
public class Base64Utils {
public static String getBASE64(byte[] data){
return new sun.misc.BASE64Encoder().encode(data);
}
public byte[] getFormBase64(String str){
if(str == null){
return null;
}else{
try {
BASE64Decoder decoder = new BASE64Decoder();
byte[] data = decoder.decodeBuffer(str);
return data;
} catch (IOException e) {
e.printStackTrace();
return null;
}
}
}
}
import sun.misc.BASE64Decoder;
/**
* BASE64
* @author ysl
*
*/
public class Base64Utils {
public static String getBASE64(byte[] data){
return new sun.misc.BASE64Encoder().encode(data);
}
public byte[] getFormBase64(String str){
if(str == null){
return null;
}else{
try {
BASE64Decoder decoder = new BASE64Decoder();
byte[] data = decoder.decodeBuffer(str);
return data;
} catch (IOException e) {
e.printStackTrace();
return null;
}
}
}
}