code: private static String getString(InputStream in) {
          try {
              StringBuffer out = new StringBuffer();
              BufferedReader reader =
                      new BufferedReader(new InputStreamReader(in));
              String line = reader.readLine();
              while (line != null) {
                  out.append(line + "\n");
                  line = reader.readLine();
              }
              return out.toString();
          } catch (Exception e) {
              return "[Error reading response body: " + e.getClass().getName()
                      + ": " + e.getMessage() + "]";
          }
      }
docs: Read the remainder of the given stream as a String and return it, or an
  error message if we encounter an error.