java.lang.Object
com.maroontress.clione.impl.ReaderSource
- All Implemented Interfaces:
Source
This source reads characters from upstream reader, counting the line and
column number.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()getChar()Returns a newSourceCharobject at the current location of this source or EOF.Returns the filename.Returns the current location of this source.voidPushes back the specifiedSourceCharobject.
-
Constructor Details
-
ReaderSource
Creates a new source.- Parameters:
reader- The reader from which characters will be read.filename- The filename.
-
-
Method Details
-
close
- Specified by:
closein interfaceSource- Throws:
IOException- If an I/O error occurs.
-
getFilename
Returns the filename.- Specified by:
getFilenamein interfaceSource- Returns:
- The filename. Or
nullif no filename is specified.
-
getLocation
Returns the current location of this source.- Specified by:
getLocationin interfaceSource- Returns:
- The current location.
-
getChar
Returns a newSourceCharobject 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
SourceorReader. It may also replace one or moreSourceCharobjects with anotherSourceCharobject and return it.- Specified by:
getCharin interfaceSource- Returns:
- The new
SourceCharobject. - Throws:
IOException- If an I/O error occurs.- See Also:
-
ungetChar
Pushes back the specifiedSourceCharobject.The
SourceCharobject to push back must not represent EOF.This method does not change the current location.
- Specified by:
ungetCharin interfaceSource- Parameters:
c- TheSourceCharobject to push back.
-