Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

InputStream to Writer  RSS feed

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do I go about converting a InputStream to a Writer ?
I can easily convert a InputStream to a String, but Iam not
quite sure how to convert InputStream to a Writer.
Any suggestions will be appreciated.
Thanks,
Sid
 
Harish Kashyap
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

first of all InputStream can be converted into Reader classes not Writer. Only OutputStream can be converted into Writer classes.
u can't convert InputStream object into string it'll just give u the description of the object. not a string u want. u convert the byte stream coming in through the InputStream into String.
let me know was your question regarding this context or not.
harish
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Harish,
Thats what I thought.. an InputStream can't be converted into a Writer.
As far as the string, I did something like this
I read the InputStream using a InputStreamReader, passed that as an input to a Buffered reader, then read each line and appended to a StringBuffer, which I converted into a String.
Iam trying to implement this Interface, which requires me to read something from a website and return it as a Writer.
Iam beginning to think the interface meant to say Reader.
Thanks for ur reply.
Sid
 
aaltekar aaltekar
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
I want to know how to convert InputStraem to string.
I am using urldatasource and getting inputstream from it. I need a string from it to show the contets as html.
Thanks
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!