Java tutorial
//package com.java2s; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; public class Main { private static String getStringFromInput(InputStream in, String format) throws IOException { StringBuilder sb = new StringBuilder(); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(in, format)); String cur = bufferedReader.readLine(); while (cur != null) { sb.append(cur); cur = bufferedReader.readLine(); } return sb.toString(); } }