Java tutorial
//package com.java2s; //License from project: Apache License import java.io.BufferedInputStream; import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; public class Main { public static String readString(InputStream inputStream) throws Exception { BufferedInputStream stream = new BufferedInputStream(inputStream); StringBuilder answer = new StringBuilder(); BufferedReader reader = new BufferedReader(new InputStreamReader(stream, "UTF-8")); String line; while ((line = reader.readLine()) != null) { answer.append(line); } reader.close(); return answer.toString(); } }