Class TextReader


  • public class TextReader
    extends Object
    Read through text string
    Since:
    2.0.3
    Author:
    osbornb
    • Constructor Detail

      • TextReader

        public TextReader​(String text)
        Constructor
        Parameters:
        text - text
      • TextReader

        public TextReader​(Reader reader)
        Constructor
        Parameters:
        reader - reader
    • Method Detail

      • getReader

        public Reader getReader()
        Get the reader
        Returns:
        reader
      • close

        public void close()
        Close the text reader
      • readToken

        public String readToken()
                         throws IOException
        Read the next token. Ignores whitespace until a non whitespace character is encountered. Returns a contiguous block of token characters ( [a-z] | [A-Z] | [0-9] | - | . | + ) or a non whitespace single character.
        Returns:
        token
        Throws:
        IOException - upon read error
      • peekToken

        public String peekToken()
                         throws IOException
        Peek at the next token without reading past it
        Returns:
        next token
        Throws:
        IOException - upon read error
      • readDouble

        public double readDouble()
                          throws IOException
        Read a double
        Returns:
        double
        Throws:
        IOException - upon read error