• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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 ?
 
Marshal
Posts: 28193
95
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
Marshal
Posts: 28193
95
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
Marshal
Posts: 28193
95
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic