/**
* colb数据转string
*
* @author yjc
* @throws AppException
* @throws Exception
* @date 创建时间 2015-7-28
* @since V1.0
*/
public static String colb2String(Clob clob) throws AppException {
if (null == clob) {
return "";
}
// 解析
int length = 0;
char[] chars = new char[1000000];
length = 0;
StringBuffer contentBF = new StringBuffer();
Reader reader;
try {
reader = clob.getCharacterStream();
} catch (SQLException e) {
e.printStackTrace();
throw new AppException("解析Clob到String时出错-SQLException", "StringUtil");
}
try {
while ((length = reader.read(chars)) != -1) {
contentBF.append(new String(chars, 0, length));
}
reader.close();
} catch (IOException e) {
e.printStackTrace();
throw new AppException("解析Clob到String时出错-IOException", "StringUtil");
}
return contentBF.toString();
}
本文欢迎转载,转载请注明:
手机扫码阅读