code: public static String readString(Reader is, char term) throws IOException {
          CharArrayWriter baos = new CharArrayWriter();
  
          int ch_int;
          while ((ch_int = is.read()) >= 0) {
              final char ch = (char) ch_int;
              if (ch == term) {
                  break;
              }
              baos.write(ch);
          }
  
          return baos.toString();
      }
docs: Read next string from input stream.
  
  @param is   The reader to read characters from.
  @param term Terminator character.
  @return The string up until, but not including the terminator.
  @throws IOException when unable to read from stream.