设为首页 加入收藏

TOP

JAVA读取BLOB
2014-10-30 16:15:07 来源: 作者: 【 】 浏览:89
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方法如何弄清进程问题

评论

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

·Shell脚本:Linux Sh (2025-12-25 05:50:11)
·VMware虚拟机安装Lin (2025-12-25 05:50:08)
·Linux学习教程,Linu (2025-12-25 05:50:06)
·工业机器人TCP校准中 (2025-12-25 05:19:17)
·opc 通讯协议与 TCP (2025-12-25 05:19:15)