Here you can find the source of parseToString(Clob clob)
Parameter | Description |
---|---|
clob | java.sql.Clob |
public static String parseToString(Clob clob)
//package com.java2s; //License from project: Apache License import java.io.BufferedReader; import java.io.Reader; import java.sql.Clob; public class Main { /**//from w ww . j a v a 2 s . co m * clob parse to string * @param clob java.sql.Clob * @return */ public static String parseToString(Clob clob) { return parseToString(clob, null); } /** * clob parse to string * @param clob java.sql.Clob * @return String */ public static String parseToString(Clob clob, String line_end) { if (clob == null) return null; StringBuffer sb = new StringBuffer(); Reader is = null; BufferedReader br = null; try { is = clob.getCharacterStream(); br = new BufferedReader(is); String line = null; while ((line = br.readLine()) != null) { sb.append(line + (line_end == null ? "" : line_end)); } } catch (Exception e) { //ignore; } finally { try { br.close(); } catch (Exception e) { } try { is.close(); } catch (Exception e) { } } return sb.toString(); } }