public static String readAsString(InputStream is) throws IOException {
  StringBuffer buf=new StringBuffer();
  byte[] b=new byte[8192];
  int nread=-1;
  while ((nread=is.read(b)) >= 0) {
    String s=new String(b,0,nread);
    buf.append(s);
  }
  return buf.toString();
}

public static String readAsString ( InputStream is ) throws IOException { StringBuffer buf = new StringBuffer ( ) ; byte [ ] b = new byte [ 8192 ] ; int nread = - 1 ; while ( ( nread = is . read ( b ) ) >= 0 ) { String s = new String ( b , 0 , nread ) ; buf . append ( s ) ; } return buf . toString ( ) ; }
reads an input stream into a single string result .
