Java tutorial
//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 { public static String getContentFromFile(InputStream is) { char[] buffer = new char[1024]; StringBuilder stringBuilder = new StringBuilder(); try { InputStreamReader inputStreamReader = new InputStreamReader(is, "UTF-8"); BufferedReader bufferedReader = new BufferedReader(inputStreamReader); while (bufferedReader.read(buffer, 0, 1024) != -1) { stringBuilder.append(buffer); } } catch (IOException e) { e.printStackTrace(); } return stringBuilder.toString(); } }