Read the contents of the file using the given reader.
@param reader The reader used to read the file stream
@param terminator The line terminator of the YAML file
@return The contents of the file as a string
166202
private String getContents(Reader reader, String terminator) throws IOException
    {
        String line = null;
        StringBuffer buff = new StringBuffer();
        BufferedReader in = new BufferedReader(reader);
        while((line = in.readLine()) != null)
        {
            buff.append(line);
            if(terminator != null)
                buff.append(terminator);
        }
        reader.close();
        return buff.toString();
    }
707106
public static MtasConfiguration readConfiguration(InputStream reader)
      throws IOException {
    MtasConfiguration currentConfig = null;
    // parse xml
    XMLInputFactory factory = XMLInputFactory.newInstance();
    try {
      XMLStreamReader streamReader = factory.createXMLStreamReader(reader);
      QName qname;
      try {
        int event = streamReader.getEventType();
        while (true) {
          switch (event) {
          case XMLStreamConstants.START_DOCUMENT:
            if (!streamReader.getCharacterEncodingScheme().equals("UTF-8")) {
              throw new IOException("XML not UTF-8 encoded");
            }
            break;
          case XMLStreamConstants.END_DOCUMENT:
          case XMLStreamConstants.SPACE:
            break;
          case XMLStreamConstants.START_ELEMENT:
            // get data
            qname = streamReader.getName();
            if (currentConfig == null) {
              if (qname.getLocalPart().equals("mtas")) {
                currentConfig = new MtasConfiguration();
              } else {
                throw new IOException("no Mtas Configuration");
              }
            } else {
              MtasConfiguration parentConfig = currentConfig;
              currentConfig = new MtasConfiguration();
              parentConfig.children.add(currentConfig);
              currentConfig.parent = parentConfig;
              currentConfig.name = qname.getLocalPart();
              for (int i = 0; i < streamReader.getAttributeCount(); i++) {
                currentConfig.attributes.put(
                    streamReader.getAttributeLocalName(i),
                    streamReader.getAttributeValue(i));
              }
            }
            break;
          case XMLStreamConstants.END_ELEMENT:
            if (currentConfig.parent == null) {
              return currentConfig;
            } else {
              currentConfig = currentConfig.parent;
            }
            break;
          case XMLStreamConstants.CHARACTERS:
            break;
          }
          if (!streamReader.hasNext()) {
            break;
          }
          event = streamReader.next();
        }
      } finally {
        streamReader.close();
      }
    } catch (XMLStreamException e) {
      log.debug(e);
    }
    return null;
  }
1278830
public Object parse(Reader reader) {
        Object content;

        JsonLexer lexer = new JsonLexer(reader);

        JsonToken token = lexer.nextToken();
        if (token.getType() == OPEN_CURLY) {
            content = parseObject(lexer);
        } else if (token.getType() == OPEN_BRACKET) {
            content = parseArray(lexer);
        } else {
            throw new JsonException(
                    "A JSON payload should start with " + OPEN_CURLY.getLabel() +
                            " or " + OPEN_BRACKET.getLabel() + ".\n" +
                            "Instead, '" + token.getText() + "' was found " +
                            "on line: " + token.getStartLine() + ", " +
                            "column: " + token.getStartColumn()
            );
        }

        return content;
    }
45654
public static String getPatternFromFile(BufferedReader reader) throws IOException {
    StringBuilder matchString = new StringBuilder();
    for (String thisLine; (thisLine = reader.readLine()) != null; ) {
      if (matchString.length() > 0 && emptyLinePattern.matcher(thisLine).matches()) {
        // A blank line after getting some real content (not just comments or nothing)
        break;
      }
      Matcher m = commentPattern.matcher(thisLine);
      if (m.matches()) {
        // delete it
        thisLine = m.replaceFirst("");
      }
      if ( ! emptyLinePattern.matcher(thisLine).matches()) {
        matchString.append(thisLine);
      }
    }
    return matchString.toString();
  }
1013521
public static BufferedReader getReader(Reader reader) {
		if (null == reader) {
			return null;
		}

		return (reader instanceof BufferedReader) ? (BufferedReader) reader : new BufferedReader(reader);
	}
536472
public void parse(Reader reader) throws IOException {
        mScanner = new Scanner(reader);

        mScanner.addErrorListener(new ErrorListener() {
            public void parseError(ErrorEvent e) {
                dispatchParseError(e);
            }
        });

        try {
            parseProperties();
        }
        finally {
            mScanner.close();
        }
    }
1051379
public static Stream<String> lines(final Reader reader) {
        N.checkArgNotNull(reader);

        return of(createLazyLineIterator(null, null, Charsets.UTF_8, reader, false));
    }
1050145
public Object parse(Reader reader) {
        if (reader == null) {
            throw new IllegalArgumentException("Reader must not be null");
        }

        Object content;
        JsonParser parser = createParser();
        content = parser.parse(reader);
        return content;
    }
1120116
public final static String process(final Reader reader, final Configuration configuration) throws IOException
    {
        final Processor p = new Processor(!(reader instanceof BufferedReader) ? new BufferedReader(reader) : reader,
                configuration);
        return p.process();
    }
666344
public ChangeSet read(final Reader reader) throws SAXException,
                                                 IOException {
        return (ChangeSet) this.parser.read( reader );
    }
928280
public static NaryTreebank readTreesInPtbFormat(Reader reader) throws IOException {
        NaryTreebank trees = new NaryTreebank();
        while (true) {
            NaryTree tree = NaryTree.readTreeInPtbFormat(reader);
            if (tree != null) {
                tree.intern();
                trees.add(tree);
            }
            if (tree == null) {
                break;
            }
        }
        return trees;
    }
1149931
protected StreamTokenizer getStreamTokenizer(Reader reader) {
        final StreamTokenizer streamTokenizer = new StreamTokenizer(reader);
        streamTokenizer.resetSyntax();
        streamTokenizer.wordChars('a', 'z');
        streamTokenizer.wordChars('A', 'Z');
        streamTokenizer.wordChars('-', '-');
        streamTokenizer.wordChars('_', '_');
        streamTokenizer.wordChars('0', '9');
        streamTokenizer.wordChars('á', ' ');
        streamTokenizer.whitespaceChars(0, ' ');
        streamTokenizer.quoteChar('"');
        streamTokenizer.eolIsSignificant(true);
        streamTokenizer.ordinaryChar('(');
        streamTokenizer.ordinaryChar(')');
        return streamTokenizer;
    }
533600
public static Parameters parse(Reader reader) throws AponParseException {
        if (reader == null) {
            throw new IllegalArgumentException("reader must not be null");
        }
        AponReader aponReader = new AponReader(reader);
        return aponReader.read();
    }
203924
public static NaryTree readTreeInPtbFormat(Reader reader) throws IOException {
        QFiles.readUntilCharacter(reader, '(');
        NaryTree root = NaryTree.readSubtreeInPtbFormat(reader);
        QFiles.readUntilCharacter(reader, ')');
        if (root == null) {
            return null;
        }
        root.updateStartEnd();
        return root;
    }
102312
private void parse(Reader reader) throws IOException {
		StringBuilder text = new StringBuilder();
		int character;
		while ((character = reader.read()) != -1) {
			boolean introducedControlSequence = false;
			if (character == SINGLE_CSI) {
				introducedControlSequence = true;
			} else if (character == MULTI_CSI[0]) {
				int nextCharacter = reader.read();
				if (nextCharacter == -1) {
					buffer.append((char) character);
					break;
				} else if (nextCharacter == MULTI_CSI[1]) {
					introducedControlSequence = true;
				} else {
					text.append((char) character);
					text.append((char) nextCharacter);
				}
			} else {
				text.append((char) character);
			}

			if (introducedControlSequence) {
				if (text.length() > 0) {
					listener.parsedString(text.toString());
					text = new StringBuilder();
				}
				parseControlSequence(reader);
			}
		}

		if (text.length() > 0) {
			listener.parsedString(text.toString());
		}
	}
521952
public static Set<String> readStopwords(BufferedReader reader) throws IOException {
    HashSet<String> words = new HashSet<String>();
    String nextLine;
    while (((nextLine = reader.readLine()) != null)) {
      words.add(nextLine.trim().toLowerCase());
    }
    return words;
  }
244790
protected AbcNode getParseTree(Reader reader) throws IOException {
		StringWriter writer = new StringWriter();
		char[] buffer = new char[32 * 1024];
		int n;
		while ((n = reader.read(buffer)) != -1) {
			writer.write(buffer, 0, n);
		}
		return getParseTree(writer.toString());
	}