Java BufferedWriter performance

I need to create large test files—near 3 GB. So I try to write for start only string "1"—to check performance and correctness. FileWriter fstream = new FileWriter("c:/out.txt"); BufferedWriter out = new BufferedWriter(fstream,10000000); for (int i = 0; i < 1000000000; i++) { //out.write(Integer.toString(1)); out.write("1"); out.newLine(); } out.close(); In future versions I need to write random integers. Now it takes on my computer 3 min 26 s. Changing size of buffere seems doesn't help. Is it possible to accelerate process of writing? Thanks.
Do your files need to consist of string/character data? Here you're going through a text encoding layer that may not be necessary. Please add more detail as to the format of the data you're trying to write into your files.

以上就是Java BufferedWriter performance的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准