File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes I/O and Streams and the fly likes Unexpected Behaviour with Writers Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Unexpected Behaviour with Writers" Watch "Unexpected Behaviour with Writers" New topic
Author

Unexpected Behaviour with Writers

jean-gobert de coster
Ranch Hand

Joined: Dec 04, 2008
Posts: 49
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
Marshal

Joined: Mar 22, 2005
Posts: 41521
    
  53
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.


Ping & DNS - my free Android networking tools app
jean-gobert de coster
Ranch Hand

Joined: Dec 04, 2008
Posts: 49
Ah ok... Buffered... figures :-) By Unexpected, I meant "that I didn't expect" of course. Thanks for the answer
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Unexpected Behaviour with Writers