Guava equivalent for IOUtils.toString(InputStream)
You stated in your comment on Calum’s answer that you were going to use CharStreams.toString(new InputStreamReader(supplier.get(), Charsets.UTF_8)) This code is problematic because the overload CharStreams.toString(Readable) states: Does not close the Readable. This means that your InputStreamReader, and by extension the InputStream returned by supplier.get(), will not be closed after this code completes. If, on the … Read more