首页 / 操作系统 / Linux / 数据库Blob数据类型转String
blob数据是存储大对象数据类型, 一般存放二进制的,所以才用字节存取。首先判断blob数据是否为空,然后采用输入流读出数据,具体代码如下:String content = null;
try { if(image != null){
InputStream is = image.getBinaryStream();
byte[] b = new byte[is.available()];
is.read(b, 0, b.length);
content = new String(b);
}
System.out.println(content);
} catch ( IOException e) {
e.printStackTrace();
}本文永久更新链接地址:http://www.linuxidc.com/Linux/2015-11/125199.htm