Here you can find the source of readAllText(final InputStream inputStream)
public static String readAllText(final InputStream inputStream) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; public class Main { public static String readAllText(final InputStream inputStream) throws IOException { try (final BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream))) { final StringBuffer buff = new StringBuffer(); String line = null;/*from ww w . j a v a2 s .co m*/ while ((line = reader.readLine()) != null) { buff.append(line + System.lineSeparator()); } return buff.toString(); } catch (NullPointerException e) { throw e; } } }