Possible Duplicate:
In Java how do a read/convert an InputStream in to a string?
Hi I want to put this BufferedInputStream into my string how can I do this?
BufferedInputStream in = new BufferedInputStream(sktClient.getInputStream() );
String a= in.read();
Please following code
Let me know the results
Thanks, Kariyachan
With Guava:
With Commons / IO:
I suggest you use apache commons IOUtils
If you don't want to write it all by yourself (and you shouldn't really) - use a library that does that for you.
Apache commons-io does just that.
Use IOUtils.toString(InputStream), or IOUtils.readLines(InputStream) if you want finer control.