blob數(shù)據(jù)是存儲大對象數(shù)據(jù)類型, 一般存放二進(jìn)制的,所以才用字節(jié)存取。
首先判斷blob數(shù)據(jù)是否為空,然后采用輸入流讀出數(shù)據(jù),具體代碼如下:
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 }
新聞熱點(diǎn)
疑難解答