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 of CharacterInput based on a Reader.
  • Constructor Details

    • ReaderInput

      public ReaderInput(Reader reader)
  • Method Details

    • directRead

      protected int directRead()
      Description copied from class: AbstractInput
      Tries to parse the next character without taking care of the peek deque.
      Specified by:
      directRead in class AbstractInput
      Returns:
      the next character, or -1 if the EOS has been reached
    • directReadChar

      protected char directReadChar() throws ParsingException
      Description copied from class: AbstractInput
      Tries to parse the next character without taking care of the peek deque.
      Specified by:
      directReadChar in class AbstractInput
      Returns:
      the next character
      Throws:
      ParsingException - if the EOS has been reached
    • read

      public CharsWrapper read(int n)
      Description copied from interface: CharacterInput
      Reads 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: CharacterInput
      Reads 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