[Java語言] Clob轉String
阿新 • • 發佈:2019-02-04
- /**
- * 將clob轉成string型別
- * @param clobhttp://www.ynmxzx.com/xgj/20160618/3724.html
- * @return
- * @throws SQLException
- * @throws IOException
- */http://www.ynmxzx.com/xgj/20160618/3725.html
- public static String ClobToString(Clob clob) throws SQLException,
- IOException {http://www.ynmxzx.com/xgj/20160618/3726.html
- String reString = "";http://www.ynmxzx.com/xgj/20160618/3727.html
- Reader is = clob.getCharacterStream();// 得到流
- BufferedReader br = new BufferedReader(is);
- String s = br.readLine();
- StringBuffer sb = new StringBuffer();
- while (s != null) {http://www.ynmxzx.com/xgj/20160618/3728.html
- sb.append(s);
- s = br.readLine();
- }www.ynmxzx.com
- reString = sb.toString();
- return reString;
- }