java Clob类型的字段转化为String类型的字段

/**
	 * 将Clob类型的字段转化为String类型的字段
	 * @param clob  Clob类型的字段
	 * @return String
	 */
	public static  String ClobToString(Clob clob){
		String reString = "";
		try{
		Reader is = clob.getCharacterStream();// 得到流
		BufferedReader br = new BufferedReader(is);
		String s = br.readLine();
		StringBuffer sb = new StringBuffer();
		while (s != null) {// 执行循环将字符串全部取出付值给StringBuffer由StringBuffer转成STRING
		sb.append(s);
		s = br.readLine();
		}
		reString = sb.toString();
		}catch( Exception e){
			e.printStackTrace();
		}
		return reString;
		}

你可能感兴趣的:(java Clob类型的字段转化为String类型的字段)