buffer-read ( n: fixnum buffer: buffer -- byte-array )
Factor handbook » The language » Collections » Locked I/O buffers

Prev:buffer-pop ( buffer: buffer -- byte )
Next:buffer-read-unsafe ( n: fixnum buffer: buffer -- n ptr )


Vocabulary
io.buffers

Inputs
na non-negative integer
buffera buffer


Outputs
byte-arraya byte-array


Word description
Collects a byte array of n bytes starting from the buffer's current position, and advances the position accordingly. If there are less than n bytes available, the output is truncated.

Examples
USING: alien destructors io.buffers kernel prettyprint ; 5 100 <buffer> [ B{ 7 14 21 } binary-object pick buffer-write buffer-read ] with-disposal .
B{ 7 14 21 }


Definition