blob數據是存儲大對象數據類型, 通常存放二進制的,因此才用字節存取。spa
首先判斷blob數據是否爲空,而後採用輸入流讀出數據,具體代碼以下:code
1 String content = null; 2 try { 3 4 if(image != null){ 5 InputStream is = image.getBinaryStream(); 6 byte[] b = new byte[is.available()]; 7 is.read(b, 0, b.length); 8 content = new String(b); 9 } 10 System.out.println(content); 11 } catch ( IOException e) { 12 e.printStackTrace(); 13 }