Class InputReader

  • Direct Known Subclasses:
    XmlInputReader

    public class InputReader
    extends Object
    Author:
    rajeshwar patil
    • Constructor Detail

      • InputReader

        public InputReader​(Reader reader)
        Construct a InputReader from a string.
        Parameters:
        reader - A reader.
      • InputReader

        public InputReader​(String s)
        Construct a InputReader from a string.
        Parameters:
        s - A source string.
    • Method Detail

      • next

        public char next()
                  throws InputException
        Get the next character in the source string.
        Returns:
        The next character, or 0 if past the end of the source string.
        Throws:
        InputException
      • error

        public InputException error​(String message)
        Resturns InputException to signal a syntax error.
        Parameters:
        message - The error message.
        Returns:
        A InputException object, suitable for throwing
      • nextNonSpace

        public char nextNonSpace()
                          throws InputException
        Get the next char in the string, skipping whitespace.
        Returns:
        A character, or 0 if there are no more characters.
        Throws:
        InputException
      • next

        public String next​(int n)
                    throws InputException
        Get the next n characters.
        Parameters:
        n - The number of characters to take.
        Returns:
        A string of n characters.
        Throws:
        InputException - Substring bounds error if there are not n characters remaining in the source string.
      • more

        public boolean more()
                     throws InputException
        Determine if the source string still contains characters that next() can consume.
        Returns:
        true if not yet at the end of the source.
        Throws:
        InputException