code: private String convertToString(Reader reader) throws IOException {
          StringBuilder stringBuilder = new StringBuilder();
          int numChars;
          char[] chars = new char[50];
          do {
              numChars = reader.read(chars, 0, chars.length);
              if (numChars > 0) {
                  stringBuilder.append(chars, 0, numChars);
              }
          } while (numChars != -1);
  
          return stringBuilder.toString();
      }
docs: Constructs a String by reading the characters from the Reader
  @param reader Reader to read from
  @return String containing the message
  @throws IOException in case of read failure