public byte[] base64ToByte(String strBase64){
if(strBase64==null)return null;
byte[] bytes = null;
try {
BASE64Decoder dec = new BASE64Decoder();
bytes = dec.decodeBuffer(strBase64);
}
catch(Exception ex){
ex.printStackTrace();
}
return bytes;
}
public String byteToBase64(byte[] aryByte){
if(aryByte==null)return "";
String strBase64 = "";
try {
BASE64Encoder enc = new BASE64Encoder();
strBase64 = enc.encode(aryByte);
}
catch(Exception ex){
ex.printStackTrace();
}
return strBase64;
}
时间: 2024-10-11 09:42:44