Java tutorial
//package com.java2s; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; public class Main { private static String readStream(InputStream is) { try { ByteArrayOutputStream bo = new ByteArrayOutputStream(); int i = is.read(); while (i != -1) { bo.write(i); i = is.read(); } return bo.toString(); } catch (IOException e) { e.printStackTrace(); return ""; } } }