设为首页 加入收藏

TOP

JAVA读取BLOB
2014-10-30 16:15:07 来源: 作者: 【 】 浏览:86
Tags:JAVA 读取 BLOB

  Java代码


  Blob blob = rs.getBlob("article_content");


  InputStream instream = blob.getBinaryStream();


  int flength=(int)blob.length();


  byte[] b = new byte[flength];


  byte[] nb=new byte[1024];


  int len=0;


  int tlen=0;


  while(flength>0){


  len=instream.read(nb);


  System.arraycopy(nb, 0, b, tlen, len);


  tlen+=len;


  flength-=len;


  }


  instream.close();


  a.setArticleContent(new String(b,"GBK"));


  编辑特别推荐:


】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇使用静态块读取属性(.properties).. 下一篇Javamain方法如何弄清进程问题

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: