0

Which method can I use to write some output to a file without modifying the format of it?

The following is the contents (as generated by the System.out.println() method) I would like to write:

=== Confusion Matrix ===

a  b   <-- classified as
47  2 |  a = 1
28  0 |  b = 0

When I use the write method on a BufferedWriter object, the entire text gets printed as one line. The output was generated by the weka tool's eval.toMatrixString() method.

Thanks in advance!

4

1 回答 1

0

您将要使用BufferedWriter#newLine在行尾添加新的行分隔符

更新

如果无法手动生成输出,您可能需要确保toMatrixString使用适当的行分隔符...

看看System.getProperty("line.separator")价值

于 2013-06-24T03:03:43.367 回答