Fmlib_node.Io_bufferSourceAn IO buffer is an array of bytes
b0 b1 b2 ... br ... bw ... bn-1
^ ^ ^
rp wp n
rp: read pointer
wp: write pointer
n: size of the buffer
Invariant: 0 <= rp <= wp <= n
rp = wp: no more to read
wp = n: buffer is fullThe type of the buffer.
alloc size allocates an io buffer of size and set its read pointer and write pointer to 0.
getc b reads the character at the read pointer of the buffer b, advances the read pointer and returns the character. If the read pointer is at the position of the write pointer, then None is retured.
putc b ch appends the character c at the position of the write pointer and advances the write pointer. If the write pointer is already at the end None is returned.
The javascript buffer object.
copy src s0 s1 dst d0 copies the data from the buffer src between position s0 and s1 (excluding s1 to the buffer dst starting at position d0. Overlapping is handled properly.