Link Details

How to convert an InputStream to a String using plain Java, Guava or Commons IO.

Posted by eugenparaschiv  |   Jan 16 2014 / 07:54

Add your comment

Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.


User 776377 avatar

lburnham123 replied ago:

Discussing converting streams to strings without discussing encodings misses the mark - using String,getBytes() is just bad.

Reply 1 votes
User 851745 avatar

Greg Brown replied ago:

"using String,getBytes() is just bad". Agreed. But he was just using that to simulate an actual input stream. He didn't use it in any of the examples he gave for decoding the stream.

Reply 0 votes
User 379952 avatar

eugenparaschiv replied ago:

Agreed - that is why all 3 examples specify their encoding so that the system default is not used. Cheers, Eugen.

Reply 0 votes

Recommended Links

Written by: Ryan Knight
Featured Refcardz: Top Refcardz:
  1. Apache Hadoop
  2. Play
  3. Akka
  4. Debugging JavaScript
  5. Design Patterns
  1. Apache Hadoop
  2. REST
  3. Java
  4. Git
  5. Java Performance
Connect with DZone