public static String toString(final InputStream is) throws IOException {
  final BufferedReader br=new BufferedReader(new InputStreamReader(is));
  final StringBuffer content=new StringBuffer();
  String line=br.readLine();
  if (line != null) {
    content.append(line);
    while ((line=br.readLine()) != null)     content.append("\n" + line);
  }
  br.close();
  return content.toString();
}

public static String toString ( final InputStream is ) throws IOException { final BufferedReader br = new BufferedReader ( new InputStreamReader ( is ) ) ; final StringBuffer content = new StringBuffer ( ) ; String line = br . readLine ( ) ; if ( line != null ) { content . append ( line ) ; while ( ( line = br . readLine ( ) ) != null ) content . append ( "\n" + line ) ; } br . close ( ) ; return content . toString ( ) ; }
read string data from a inputstream and returns it as string object
