Here you can find the source of loadIntoString(InputStream is)
public static String loadIntoString(InputStream is) throws IOException
//package com.java2s; /* /*from w ww .j a va2s . c om*/ GeoGebra - Dynamic Mathematics for Everyone http://www.geogebra.org This file is part of GeoGebra. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation. */ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; public class Main { /** * Writes all contents of the given InputStream to a String */ public static String loadIntoString(InputStream is) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(is, "UTF8")); StringBuilder sb = new StringBuilder(); String line = null; try { while ((line = reader.readLine()) != null) { sb.append(line + "\n"); } } catch (IOException e) { e.printStackTrace(); } return sb.toString(); } }