This commit is contained in:
Looly
2020-03-01 00:24:28 +08:00
parent 405a92cfe4
commit d5506b7d9e
7 changed files with 146 additions and 45 deletions

View File

@@ -296,6 +296,17 @@ public class IoUtil {
// -------------------------------------------------------------------------------------- Copy end
// -------------------------------------------------------------------------------------- getReader and getWriter start
/**
* 获得一个文件读取器默认使用UTF-8编码
*
* @param in 输入流
* @return BufferedReader对象
* @since 5.1.6
*/
public static BufferedReader getUtf8Reader(InputStream in) {
return getReader(in, CharsetUtil.CHARSET_UTF_8);
}
/**
* 获得一个文件读取器
*
@@ -358,6 +369,17 @@ public class IoUtil {
return (reader instanceof PushbackReader) ? (PushbackReader) reader : new PushbackReader(reader, pushBackSize);
}
/**
* 获得一个Writer默认编码UTF-8
*
* @param out 输入流
* @return OutputStreamWriter对象
* @since 5.1.6
*/
public static OutputStreamWriter getUtf8Writer(OutputStream out) {
return getWriter(out, CharsetUtil.CHARSET_UTF_8);
}
/**
* 获得一个Writer
*