public static String readData(InputStream in)
   {
      StringBuffer sb = new StringBuffer();
      try {
         BufferedReader br = new BufferedReader(new InputStreamReader(in));
         String line = null;
         while ((line = br.readLine()) != null) {
            sb.append(line + "\n");
         }
      } catch (IOException ioex) {
         log.error("Got an exception while reading input stream", ioex);
      }
      return sb.toString();
   }