Handbook
Glossary
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
n
a non-negative integer
buffer
a
buffer
Outputs
byte-array
a
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
USING:
alien.data
kernel
typed
;
IN:
io.buffers
TYPED:
buffer-read
( n: fixnum buffer: buffer -- byte-array )
buffer-read-unsafe
swap
memory>byte-array
;
inline