Byte arrays
Factor handbook > The language > Collections

Prev:Strings
Next:Specialized arrays


Byte arrays are fixed-size mutable sequences (Sequence protocol) whose elements are integers in the range 0-255, inclusive. Each element only uses one byte of storage, hence the name. The literal syntax is covered in Byte array syntax.

Byte array words are in the byte-arrays vocabulary.

Byte arrays play a special role in the C library interface; they can be used to pass binary data back and forth between Factor and C. See Passing pointers to C functions.

Byte arrays form a class of objects.
byte-array

byte-array? ( object -- ? )


There are several ways to construct byte arrays.
>byte-array ( seq -- byte-array )

<byte-array> ( n -- byte-array )

1byte-array ( x -- byte-array )

2byte-array ( x y -- byte-array )

3byte-array ( x y z -- byte-array )

4byte-array ( w x y z -- byte-array )


Resizing byte arrays:
resize-byte-array ( n byte-array -- new-byte-array )