blob 转换为byte[]
public byte[] blobToByte(Blob blob) throws Exception {
byte[] bytes = null;
try {
InputStream in=blob.getBinaryStream();
BufferedInputStream inBuffered = new BufferedInputStream(in);
ByteArrayOutputStream out = new ByteArrayOutputStream(1024);
byte[] temp = new byte[1024];
int size = 0;
while ((size = inBuffered.read(temp)) != -1) {
out.write(temp, 0, size);
}
inBuffered.close();
in.close();
bytes = out.toByteArray();
} catch(Exception ex){
ex.printStackTrace();
}
return bytes;
}
原文地址:http://www.cnblogs.com/xiaohaizhuimeng/p/3907732.html