Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Unexpected Behaviour with Writers

 
jean-gobert de coster
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I'm running he following code:



And when I run it, the output is the following:

Hello!I'm a FileWriter
I'm a BufferedWriter
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why is that unexpected behavior? The buffered writer buffers its output, while the straight writer writes immediately. Seems like it should be.

As an aside, I wouldn't use several writers that access the same underlying resource.
 
jean-gobert de coster
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah ok... Buffered... figures :-) By Unexpected, I meant "that I didn't expect" of course. Thanks for the answer
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic