Interface Source

All Known Implementing Classes:
PhaseOneSource, PhaseTwoSource, ReaderSource, ReparseSource

public interface Source
Provides the stream of the source file.
  • Method Details

    • close

      void close() throws IOException
      Closes this source and its upstream Source or Reader.
      Throws:
      IOException - If an I/O error occurs.
    • getFilename

      String getFilename()
      Returns the filename.
      Returns:
      The filename. Or null if no filename is specified.
    • getLocation

      SourceLocation getLocation()
      Returns the current location of this source.
      Returns:
      The current location.
    • getChar

      SourceChar getChar() throws IOException
      Returns a new SourceChar object at the current location of this source or EOF.

      This method does not change the current location either if the return value represents EOF or is the object that has been pushed back. Otherwise, the current location proceeds the next one.

      This method may read two or more characters from the upstream Source or Reader. It may also replace one or more SourceChar objects with another SourceChar object and return it.

      Returns:
      The new SourceChar object.
      Throws:
      IOException - If an I/O error occurs.
      See Also:
    • ungetChar

      void ungetChar(SourceChar c)
      Pushes back the specified SourceChar object.

      The SourceChar object to push back must not represent EOF.

      This method does not change the current location.

      Parameters:
      c - The SourceChar object to push back.
      Throws:
      IllegalArgumentException - If the object represents EOF.