Closed xiaohe27 closed 9 years ago
third approach: use a stringbuilder to accumulate the output, if it is full then use Files.wrtie to write it to output file and then empty it and repeat the process. At the end, if something is still in stringbuilder, then write it to output file.
Not the second approach, too many io ops involved...
Idea: for output to std.out, use stringbuilder for output to file, do not encode to string, just write bytes to file
use byte buffer to gather output bytes
Size of output file is unknown, not good idea to use mbb etc. Currently, buffered writer is the most efficient way
compare two approaches: 1) BufferedWriter 2) Files.write bytes
Also observe the perf diff when using different charset