BLOB的一个问题,请高手们解决一下
我用HIBERNATE取到一个BLOB类型的数组以后,
不管我是用
InputStream ins = blob.getBinaryStream();
//用文件模拟输出流
File file = new File("d:/1.txt");
OutputStream fout = new FileOutputStream(file);
//下面将BLOB数据写入文件
byte[] b = new byte[1024];
int len = 0;
while ( (len = ins.read(b)) != -1) {
fout.write(b, 0, len);
}
//依次关闭
fout.close();
ins.close();
这样取,或是:
byte[]buf =new byte[12800];
InputStream input=blob.getBinaryStream();
ByteArrayOutputStream os=new ByteArrayOutputStream();
int len = 0;
while ((len =input.read(buf))!=-1)
os.write(buf,0,len);
byte[] b=os.toByteArray();
os.flush();
os.close();
for(int i=0; i<b.length;i++)
System.out.println(b[i]);
这样取,我得到的是_RCFM*=€?/+NEC-15LCD/////憗
或是12,47,34,-222,234......这样的东西,请会的大哥们帮忙解决一下