read String From Stream
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.nio.charset.Charset; class Main { public static String readStringFromStream(InputStream stream) throws IOException { InputStreamReader isReader = new InputStreamReader(stream, Charset.forName("utf-8")); BufferedReader br = new BufferedReader(isReader); StringBuilder sb = new StringBuilder(); String line; while ((line = br.readLine()) != null) { sb.append(line).append("\n"); } return sb.toString(); } }