赞
踩
public String clobToString(Object obj) {
String retValue = "";
BufferedReader reader = null;
if (obj instanceof Clob) {
try {
Clob clob = (Clob) obj;
reader = new BufferedReader(clob.getCharacterStream());
String line = reader.readLine();
StringBuilder sb = new StringBuilder();
while (line != null) {
sb.append(line).append("\r\n");
line = reader.readLine();
}
retValue = sb.toString();
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (reader != null) {
reader.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
} else {
retValue = obj == null ? "" : (String) obj;
}
return retValue;
}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。