oracle库 16进制 Blob类型 转String

皮卡皮卡屁卡丘 2018-11-02 04:10:50
RT,库中存的是16进制的BLOB类型的值,对象中定义的是String类型接收,请问大佬们,如何转?
...全文
306 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
卖水果的net 2018-11-09
  • 打赏
  • 举报
回复
要不要给你移动到 高级语言区 ? 是 java 还是 C#
诗和远方C 2018-11-08
  • 打赏
  • 举报
回复
先转byte数组,再转string字符
  • 打赏
  • 举报
回复
引用 1 楼 Wazy_CSDN 的回复:
首先判断blob数据是否为空,然后采用输入流读出数据

String content = null; 
    try {
  
     if(image != null){
      InputStream is = image.getBinaryStream();
      byte[] b = new byte[is.available()];
      is.read(b, 0, b.length);
      content = new String(b); 
     }
   System.out.println(content);
   } catch ( IOException e) {
    e.printStackTrace();
   }
项目中这个字段是 String类型修饰的
Wazy_csdn 2018-11-02
  • 打赏
  • 举报
回复
首先判断blob数据是否为空,然后采用输入流读出数据

String content = null; 
    try {
  
     if(image != null){
      InputStream is = image.getBinaryStream();
      byte[] b = new byte[is.available()];
      is.read(b, 0, b.length);
      content = new String(b); 
     }
   System.out.println(content);
   } catch ( IOException e) {
    e.printStackTrace();
   }

17,082

社区成员

发帖
与我相关
我的任务
社区描述
Oracle开发相关技术讨论
社区管理员
  • 开发
  • Lucifer三思而后行
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧