aspose file tools*
The moose likes I/O and Streams and the fly likes Undo redirect to file 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 "Undo redirect to file" Watch "Undo redirect to file" New topic
Author

Undo redirect to file

Kaustubha Raut
Greenhorn

Joined: Nov 05, 2009
Posts: 4
Hi,

I have used the following code to redirect the output to a file, but I am not able to find how to undo this and direct stdout back to console in later part of the program.
How do I set the System.setout() to print to console again?

Thanks.

Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19693
    
  20

Store a reference to System.out before you change it initially, then change it back:
This means that you will need to store it somewhere of course, probably as an instance field or something similar.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Kaustubha Raut
Greenhorn

Joined: Nov 05, 2009
Posts: 4
Thanks Rob,
It works.....
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Undo redirect to file