Android examples for java.io:InputStream
Read InputStream KB by KB
import java.io.InputStream; public class Main { public static String getContentByString(InputStream is) { try {/* w w w .j av a 2 s. c o m*/ if (is == null) return null; byte[] b = new byte[1024]; int len = -1; StringBuilder sb = new StringBuilder(); while ((len = is.read(b)) != -1) { sb.append(new String(b, 0, len)); } return sb.toString(); } catch (Exception e) { // TODO: handle exception } return null; } }