Class ReaderInput
- java.lang.Object
-
- com.electronwill.nightconfig.core.io.AbstractInput
-
- com.electronwill.nightconfig.core.io.ReaderInput
-
- All Implemented Interfaces:
CharacterInput
public final class ReaderInput extends AbstractInput
An implementation ofCharacterInputbased on aReader.
-
-
Field Summary
-
Fields inherited from class com.electronwill.nightconfig.core.io.AbstractInput
deque
-
-
Constructor Summary
Constructors Constructor Description ReaderInput(java.io.Reader reader)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected intdirectRead()Tries to parse the next character without taking care of the peek deque.protected chardirectReadChar()Tries to parse the next character without taking care of the peek deque.CharsWrapperread(int n)Reads the next n characters, if possible.CharsWrapperreadChars(int n)Reads the next n characters.-
Methods inherited from class com.electronwill.nightconfig.core.io.AbstractInput
consumeDeque, peek, peek, peekChar, peekChar, pushBack, read, readChar, readCharsUntil, readUntil, skipPeeks
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.electronwill.nightconfig.core.io.CharacterInput
readAndSkip, readCharAndSkip
-
-
-
-
Method Detail
-
directRead
protected int directRead()
Description copied from class:AbstractInputTries to parse the next character without taking care of the peek deque.- Specified by:
directReadin classAbstractInput- Returns:
- the next character, or -1 if the EOS has been reached
-
directReadChar
protected char directReadChar() throws ParsingExceptionDescription copied from class:AbstractInputTries to parse the next character without taking care of the peek deque.- Specified by:
directReadCharin classAbstractInput- Returns:
- the next character
- Throws:
ParsingException- if the EOS has been reached
-
read
public CharsWrapper read(int n)
Description copied from interface:CharacterInputReads the next n characters, if possible. If there are less than n available characters, return all the remaining characters.- Parameters:
n- the number of characters to parse- Returns:
- an array containing at most n characters, not null
-
readChars
public CharsWrapper readChars(int n)
Description copied from interface:CharacterInputReads the next n characters. If there isn't n available characters, this method throws an exception.- Parameters:
n- the number of characters to parse- Returns:
- an array containing the next n characters, not null
-
-