Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

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!

Best way to Convert Reader to InputStream

843830Dec 9 2008 — edited Dec 9 2008
Hi All,

I have an Reader object obtained through ResultSet.getCharacterStream() method, I'm in need to convert the Reader object to InputStream object for my XMLDecoder to process.

Any help is appreciated.

Thanks.

Note: I have a work around as Reader >> OutputStreamWriter (ByteArrayOutputStream) >> ByteInputStream.
But I need to know better solution for the problem, because the stream has been accessed twice which leads to a perfomance issue.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 6 2009
Added on Dec 9 2008
3 comments
257 views