Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to convert String to OutputStream?

416044Jul 12 2007 — edited Jul 12 2007
A method needs a parameter OutputStream to write result data (text) to. It works fine when I set new FileOutputStream(myFile) as the parameter value. But how can I set an OutputStream that is not a file (but in memory). E.g. I would like to set a StringBuilder/StringBuffer as the parameter instead of the OutputStream. Is there a way to "wrap" a StringBuilder/StringBuffer/STring into an OutputStream?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 9 2007
Added on Jul 12 2007
2 comments
1,891 views