0 works

Convert an InputStream into a String in Java


dashboard

Posted by @starbucks #java

StringWriter writer = new StringWriter();
IOUtils.copy(inputStream, writer, encoding);
String theString = writer.toString();
content_copy

You need to use Apache commons IOUtils.

https://stackoverflow.com/questions/309424/how-do-i-read-convert-an-inputstream-into-a-string-in-java

>> Browse more code snippets

more_vert