- All Known Implementing Classes:
PhaseOneSource
,PhaseTwoSource
,ReaderSource
public interface Source
Provides the stream of the source file.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
getChar()
Returns a newSourceChar
object at the current location of this source or EOF.Returns the current location of this source.void
Pushes back the specifiedSourceChar
object.
-
Method Details
-
close
- Throws:
IOException
- If an I/O error occurs.
-
getLocation
SourceLocation getLocation()Returns the current location of this source.- Returns:
- The current location.
-
getChar
Returns a newSourceChar
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
orReader
. It may also replace one or moreSourceChar
objects with anotherSourceChar
object and return it.The return value representing EOF may differ from
SourceChar.STATIC_EOF
. Do not compare it withSourceChar.STATIC_EOF
, useSourceChar.isEof()
method instead.- Returns:
- The new
SourceChar
object. - Throws:
IOException
- If an I/O error occurs.- See Also:
-
ungetChar
Pushes back the specifiedSourceChar
object.The
SourceChar
object to push back must not represent EOF.This method does not change the current location.
- Parameters:
c
- TheSourceChar
object to push back.- Throws:
IllegalArgumentException
- If the object represents EOF.
-