java 取Blob转为String
生活随笔
收集整理的這篇文章主要介紹了
java 取Blob转为String
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
InputStream ins = null;StringBuffer sb = new StringBuffer();try {//blob要轉換的Blob字段。ins = blob.getBinaryStream();byte[] dis = new byte[1024];int len = 0;//開始處理流,并且顯示while ((len = ins.read(dis)) != -1) {String disp = new String(dis,0,len);sb.append(disp);}ins.close();}catch (Exception e) {throw e;} finally {if(ins!=null){ins.close();}}System.out.println(sb.toString());
1、blob轉為byte類型
byte[] object = (byte[]) blob;2、byte轉為流
InputStream ins = new ByteArrayInputStream(byte);總結
以上是生活随笔為你收集整理的java 取Blob转为String的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: apache启动错误 AH00072:
- 下一篇: win7安装composer