RollingCharBuffer

Acts like a forever growing char[] as you read characters into it from the provided reader, but internally it uses a circular buffer to only hold the characters that haven't been freed yet. This is like a PushbackReader, except you don't have to specify up-front the max size of the buffer, but you do have to periodically call freeBefore.

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard
fun freeBefore(pos: Int)

Call this to notify us that no chars before this absolute position are needed anymore.

Link copied to clipboard
fun get(pos: Int): Int

Absolute position read. NOTE: pos must not jump ahead by more than 1! Ie, it's OK to read arbitrarily far back (just not prior to the last freeBefore), but NOT ok to read arbitrarily far ahead. Returns -1 if you hit EOF.

fun get(posStart: Int, length: Int): CharArray
Link copied to clipboard
fun reset(reader: Reader)

Clear array and switch to new reader.