Package monq.jfa
Class ReaderCharSource
java.lang.Object
monq.jfa.ReaderCharSource
- All Implemented Interfaces:
CharSource
Wraps a Reader or an input stream to provide a CharSource.
NOTE: This class has no close() method. Any wrappend closeable input
must be closed by the code providing it.
-
Constructor Summary
ConstructorsConstructorDescriptionReaderCharSource(InputStream in, Charset chSet) Wraps theInputStreaminto aReader, using an encoding for the given character set. -
Method Summary
Modifier and TypeMethodDescriptionintResets this to a previously setCharSource.mark().voidmark()Sets a mark until which we may want to skip back withCharSource.backToMark()to re-read part of the input.intread()returns a single character or -1 to indicate end of file.
-
Constructor Details
-
ReaderCharSource
-
ReaderCharSource
Wraps the
InputStreaminto aReader, using an encoding for the given character set.The
Readerused internally cannot be closed. Anyone who thinks this is a problem, please let me know. But don't forget to close theInputStreameventually.
-
-
Method Details
-
read
Description copied from interface:CharSourcereturns a single character or -1 to indicate end of file.- Specified by:
readin interfaceCharSource- Throws:
IOException
-
mark
public void mark()Description copied from interface:CharSourceSets a mark until which we may want to skip back withCharSource.backToMark()to re-read part of the input. The initial mark is always at the start of the input, so that after a call tobackToMarkthe wholeCharSourcecan be re-read.- Specified by:
markin interfaceCharSource
-
backToMark
public int backToMark()Description copied from interface:CharSourceResets this to a previously setCharSource.mark().- Specified by:
backToMarkin interfaceCharSource
-