Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / May 2007

Tip: Looking for answers? Try searching our database.

Conversion from Input Stream to Output Stream

Thread view: 
Kashif Ur Rehman - 17 May 2007 18:42 GMT
How to convert from InputStream to OutputStream as I am using
jdk1.4.2.

Thanks
Daniel Pitts - 17 May 2007 19:36 GMT
> 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?
Tom Hawtin - 17 May 2007 20:50 GMT
> 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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.