Apache Commons IO has a nice convenience method IOUtils.toString() to read an InputStream
to a String.
Since I am trying to move away from Apache Common
UPDATE: Looking back, I don't like my old solution. Besides it is 2013 now and there are better alternatives available now for Java7. So here is what I use now:
InputStream fis = ...;
String text;
try ( InputStreamReader reader = new InputStreamReader(fis, Charsets.UTF_8)){
text = CharStreams.toString(reader);
}
or if with InputSupplier
InputSupplier spl = ...
try ( InputStreamReader reader = spl.getInput()){
text = CharStreams.toString(reader);
}