Util工具類 Clob轉成String類型

/**
 * 將字Clob轉成String類型
 * <p>
 * 2017年8月31日 15:24:48
 * xj
 *
 * @param sc clob對象
 * @return String
 * @throws SQLException
 * @throws IOException
 */
public static String ClobToString(Clob sc) throws SQLException, IOException {
    String reString = "";
    // 得到流
    Reader is = sc.getCharacterStream();
    BufferedReader br = new BufferedReader(is);
    String s = br.readLine();
    StringBuffer sb = new StringBuffer();
    // 執行循環將字符串全部取出付值給StringBuffer由StringBuffer轉成STRING
    while (s != null) {
        sb.append(s);
        s = br.readLine();
    }
    reString = sb.toString();
    
    return reString;
}


更多工具類方法:http://blog.csdn.net/qq_34117825/article/details/78392976

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章