public class StreamTools { public static String readStreamTools(InputStream is){ try { ByteArrayOutputStream baos=new ByteArrayOutputStream(); byte[] buffer=new byte[1024]; int len=0; while ((len=is.read(buffer))!=-1){ baos.write(buffer,0,len); } return baos.toString(); } catch (Exception e) { e.printStackTrace(); } return null; } }