Get String From InputStream

Instantiate a Java String from an InputStream.

Javadoc available at https://www.javatapas.com/docs/javatapas/io/GetStringFromInputStream.html


public static String getStringFromInputStream(InputStream inputStream) throws IOException {

	StringBuffer sb = new StringBuffer();
	BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));

	String line = reader.readLine();

	while(line != null){
		sb.append(line);
		line = reader.readLine();
	}

	return sb.toString();

}