Forums Register Login

InputStream to fileReader

+Pie Number of slices to send: Send
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 ?
+Pie Number of slices to send: Send
You can't. But why do you think you need a FileReader, anyway? Can't you use some other kind of Reader?
+Pie Number of slices to send: Send
@Paul

please help me out.
+Pie Number of slices to send: Send
 

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.
+Pie Number of slices to send: Send
@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.
+Pie Number of slices to send: Send
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.
Listen. That's my theme music. That's how I know I'm a super hero. That, and this tiny ad told me:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 6556 times.
Similar Threads
How to display content of a url by using httpurlconnection?
How to read Franch from ResourceBundle
How to check if HttpURLConnection exists using the object, which was open before
How to get a String from an InputStream
Searching google images from java code
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 18, 2024 20:46:39.