public static String readStream(InputStream in){
  BufferedReader reader=new BufferedReader(new InputStreamReader(in));
  StringBuilder sb=new StringBuilder();
  String line=null;
  try {
    while ((line=reader.readLine()) != null) {
      sb.append(line + "\n");
    }
  }
 catch (  IOException e) {
    FreshAirLog.e("Error reading stream",e);
  }
 finally {
    try {
      in.close();
    }
 catch (    IOException e) {
    }
    try {
      reader.close();
    }
 catch (    IOException e) {
    }
  }
  return sb.toString();
}

public static String readStream ( InputStream in ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( in ) ) ; StringBuilder sb = new StringBuilder ( ) ; String line = null ; try { while ( ( line = reader . readLine ( ) ) != null ) { sb . append ( line + "\n" ) ; } } catch ( IOException e ) { FreshAirLog . e ( "Error reading stream" , e ) ; } finally { try { in . close ( ) ; } catch ( IOException e ) { } try { reader . close ( ) ; } catch ( IOException e ) { } } return sb . toString ( ) ; }
utility method for pulling plain text from an inputstream object
