clob类型数据如何在页面展示

img


我现在是转换成string可以显示,但是数据的空格和换行就都没了

public static String getBeautifulClobValue(Clob clob) {
String value = "";

    if(clob != null) {
        try {
            Reader is = clob.getCharacterStream();
            BufferedReader br = new BufferedReader(is);
            String s = br.readLine();
            while (s != null) {
                value += s+"\n";
                s = br.readLine();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    
    return value;
}

数据库oracle中Clob字段对应的Java字段使用String类型。
需要换行可以自己加上。