Conversion from Input Stream to Output Stream

K

Kashif Ur Rehman

How to convert from InputStream to OutputStream as I am using
jdk1.4.2.

Thanks
 
D

Daniel Pitts

How to convert from InputStream to OutputStream as I am using
jdk1.4.2.

Thanks

You can't convert an input stream to an output stream. That's like
asking how to convert a fountain to a wet-vac.

InputStream is used to read data from, and an OutputStream is where
you send data to. What exactly are you trying to do?
 
T

Tom Hawtin

Kashif said:
How to convert from InputStream to OutputStream as I am using
jdk1.4.2.

If you have a thread that is writing to an OutputStream and you want to
read the results from an InputStream, either use Piped(In|Out)putStream,
or buffer the whole thing in a BufferedArrayOutputStream and then use
toByteArray followed by a new BufferedArrayInputStream.

If you have a method of some description that requires an InputStream
and you want to feed it through an OutputStream, either create a thread
that copies from input to output, or do the same thing as above with
BufferedArray(In|Out)putStream.

Tom Hawtin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top