This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes I/O and Streams and the fly likes converting output to input Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "converting output to input" Watch "converting output to input" New topic
Author

converting output to input

Dan Murphy
Ranch Hand

Joined: Mar 29, 2005
Posts: 126
Hi,

What is the best way to convert either a Writer or an OutputStream to either a Reader or an InputStream? Just to be clear, what I`m looking for is the most efficient way to do *any one* of the following (not *all* of them):

- OutputStream => Reader
- OutputStream => InputStream
- Writer => Reader
- Writer => InputStream

Thanks in advance,
Don


SCJP, SCJD, SCWCD
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19679
    
  18

You mean that one class writes to the writer, and another class reads from the reader, and the writer and reader are linked?

That's just what PipedReader + PipedWriter or PipedInputStream / PipedOutputStream are for.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: converting output to input