This commit is contained in:
2022-05-04 22:18:59 +08:00
parent adcc060a94
commit db9cd60424
@@ -21,7 +21,6 @@ import java.util.Map;
*/ */
public class PostCommonUtil { public class PostCommonUtil {
public static List<PostCustom> getNewPostsObjMap(List<Map<String, Object>> posts) { public static List<PostCustom> getNewPostsObjMap(List<Map<String, Object>> posts) {
List<PostCustom> postCustomList = new ArrayList<>(); List<PostCustom> postCustomList = new ArrayList<>();
@@ -105,13 +104,15 @@ public class PostCommonUtil {
return mainListResult; return mainListResult;
} }
// Clob类型转换成String类型 /**
* Clob类型转换成String类型
* @param clob
* @return
*/
public static String clobToString(final Clob clob) { public static String clobToString(final Clob clob) {
if (clob == null) { if (clob == null) {
return null; return null;
} }
Reader is = null; Reader is = null;
try { try {
is = clob.getCharacterStream(); is = clob.getCharacterStream();
@@ -119,14 +120,12 @@ public class PostCommonUtil {
e.printStackTrace(); e.printStackTrace();
} }
BufferedReader br = new BufferedReader(is); BufferedReader br = new BufferedReader(is);
String str = null; String str = null;
try { try {
str = br.readLine(); // 读取第一行 str = br.readLine(); // 读取第一行
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
StringBuffer sb = new StringBuffer(); StringBuffer sb = new StringBuffer();
while (str != null) { // 如果没有到达流的末尾,则继续读取下一行 while (str != null) { // 如果没有到达流的末尾,则继续读取下一行
sb.append(str); sb.append(str);
@@ -136,9 +135,7 @@ public class PostCommonUtil {
e.printStackTrace(); e.printStackTrace();
} }
} }
String returnString = sb.toString(); String returnString = sb.toString();
return returnString; return returnString;
} }
} }