• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

InputStream to fileReader

 
Greenhorn
Posts: 13
Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
just go through the following code




here the problem is at the line

reader = new FileReader(connection.getInputStream());



how can I convert InputStream to fileReader ?
 
Sheriff
Posts: 28394
100
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can't. But why do you think you need a FileReader, anyway? Can't you use some other kind of Reader?
 
asit dhal
Greenhorn
Posts: 13
Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@Paul

please help me out.
 
Paul Clapham
Sheriff
Posts: 28394
100
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

asit dhal wrote:@Paul

please help me out.



In what way? I asked you a question. That was intended to help you out. You can ignore it if you aren't interested in any help.
 
asit dhal
Greenhorn
Posts: 13
Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@Paul

Sorry, I didn't read your question properly.

I have a utility class which takes FileReader object as a parameter. I can't modify that.
 
Paul Clapham
Sheriff
Posts: 28394
100
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No competent writer of utility classes would write something which accepted a FileReader, when accepting a Reader would be much more user-friendly. So in my opinion it should really be changed.

But I'm sure you are right, you won't have the power to get it changed, no matter how badly it was originally written. In the meantime your workaround is to read the data from that InputStream and write it to a file on the local disk. Then get a FileReader from that file once you have finished that step.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic