adam bien's blog

Reading InputStream Into String With Java 8 📎


    public static String read(InputStream input) throws IOException {
        try (BufferedReader buffer = new BufferedReader(new InputStreamReader(input))) {
            return buffer.lines().collect(Collectors.joining("\n"));
        }
    }


See also: "Reducing a list into a csv string"