把oracle 中的clobe 字段转换成String 类型方便使用

View Code
 1 /**
 2      * 把clob类型的数据转换称string 类型
 3      * 作者:母玉山
 4      * 时间:2012-6-6
 5      * @param clob
 6      * @return
 7      * @throws SQLException
 8      * @throws IOException
 9      */
10     public String ClobToString(Clob clob) throws SQLException, IOException {
11         String reString = "";
12         Reader is = clob.getCharacterStream();// 得到流
13         BufferedReader br = new BufferedReader(is);
14         String s = br.readLine();
15         StringBuffer sb = new StringBuffer();
16         while (s != null) {// 执行循环将字符串全部取出付值给StringBuffer由StringBuffer转成STRING
17         sb.append(s);
18         s = br.readLine();
19         }
20         reString = sb.toString();
21         return reString;
22         }

 

相关文章:

  • 2021-05-29
  • 2022-12-23
  • 2021-09-21
  • 2022-12-23
  • 2021-11-11
  • 2023-02-15
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-13
  • 2021-11-09
相关资源
相似解决方案