提交 c0135cee authored 作者: Thomas Mueller's avatar Thomas Mueller

save memory

上级 9c26bbb3
......@@ -303,7 +303,7 @@ public class TraceSystem implements TraceWriter {
// can't be opened
return false;
}
fileWriter = IOUtils.getWriter(FileUtils.openFileOutputStream(fileName, true));
fileWriter = IOUtils.getUnbufferedWriter(FileUtils.openFileOutputStream(fileName, true));
printWriter = new PrintWriter(fileWriter, true);
} catch (Exception e) {
logWritingError(e);
......
......@@ -355,8 +355,8 @@ public class IOUtils {
}
/**
* Create a writer to write to an output stream using the UTF-8 format. If
* the output stream is null, this method returns null.
* Create a buffered writer to write to an output stream using the UTF-8
* format. If the output stream is null, this method returns null.
*
* @param out the output stream or null
* @return the writer
......@@ -368,6 +368,21 @@ public class IOUtils {
throw Message.convert(e);
}
}
/**
* Create an unbuffered writer to write to an output stream using the UTF-8
* format. If the output stream is null, this method returns null.
*
* @param out the output stream or null
* @return the writer
*/
public static Writer getUnbufferedWriter(OutputStream out) throws SQLException {
try {
return out == null ? null : new OutputStreamWriter(out, Constants.UTF8);
} catch (UnsupportedEncodingException e) {
throw Message.convert(e);
}
}
/**
* Create an input stream to read from a string. The string is converted to
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论