Here you can find the source of readAllFromInputStream(InputStream inputStream)
Parameter | Description |
---|---|
inputStream | the instance from which you want to read. |
public static String readAllFromInputStream(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 { /**/*from w w w .j av a 2 s .c om*/ * Read all the content from an InputStream instance. * @param inputStream the instance from which you want to read. * @return Read all the content from an inputStream instance. */ public static String readAllFromInputStream(InputStream inputStream) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream)); String result = "", line = ""; while ((line = reader.readLine()) != null) { result += line; } return result; } }