Class IncludingCharBuf.CharBuf

java.lang.Object
eu.bandm.tools.rdparser.IncludingCharBuf.CharBuf
Enclosing class:
IncludingCharBuf<D>

protected class IncludingCharBuf.CharBuf extends Object
Auxiliary class for IncludingCharBuf, representing exactly one source of character data, ie the original file or inserted expansions.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected static final int
    How many characters to read when filling from file.
    protected char[]
    The complete data, read in when constructing the object.
    Chaining to calling CharBuf object.
    protected int
    The length of the complete data, in characters.
    protected int
    Current read position.
  • Constructor Summary

    Constructors
    Constructor
    Description
    CharBuf(char[] s, IncludingCharBuf<D>.@Opt CharBuf buf, @Opt Location<D> loc)
    Create a new buffer, link it via host to the calling text, and take the array s as its character data.
    Create a new buffer, link it via host to the calling text, and fill it with all character data from r.
  • Method Summary

    Modifier and Type
    Method
    Description
    char
    bufferLA(int k)
    Look ahead to the next k-th character, either in its own data, or in the caller.
    protected void
    Fill the data from all contents of the reader, until its "eof".

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • data

      protected char[] data
      The complete data, read in when constructing the object.
    • len

      protected int len
      The length of the complete data, in characters.
    • CHUNKSIZE

      protected static final int CHUNKSIZE
      How many characters to read when filling from file.
      See Also:
    • pos

      protected int pos
      Current read position.
    • host

      @Opt protected IncludingCharBuf<D>.@Opt CharBuf host
      Chaining to calling CharBuf object.
  • Constructor Details

    • CharBuf

      public CharBuf(Reader r, @Opt IncludingCharBuf<D>.@Opt CharBuf buf, @Opt @Opt Location<D> loc) throws IOException
      Create a new buffer, link it via host to the calling text, and fill it with all character data from r.
      Parameters:
      r - source
      buf - calling predecessor
      loc - location of the start of the data
      Throws:
      IOException
    • CharBuf

      public CharBuf(char[] s, @Opt IncludingCharBuf<D>.@Opt CharBuf buf, @Opt @Opt Location<D> loc)
      Create a new buffer, link it via host to the calling text, and take the array s as its character data.
      Parameters:
      s - a character store, directly used by the new buffer.
      buf - calling predecessor
      loc - location of the start of the data
  • Method Details

    • fill

      protected void fill(Reader fr) throws IOException
      Fill the data from all contents of the reader, until its "eof".
      Throws:
      IOException
    • bufferLA

      public char bufferLA(int k)
      Look ahead to the next k-th character, either in its own data, or in the caller. The next-to-consume character is looked at with k=0(zero).