byte-array
Factor documentation > Factor handbook > The language > Collections > Byte arrays
Next:byte-array? ( object -- ? )


Vocabulary
byte-arrays

Word description
The class of byte arrays. See Byte array syntax for syntax and Byte arrays for general information.

Definition
USING: sequences.private ;

IN: byte-arrays

BUILTIN: byte-array
{ length array-capacity read-only initial: 0 } ;


Methods
USING: bootstrap.image.private byte-arrays kernel layouts
sequences ;

M: byte-array '
[
byte-array [
dup length emit-fixnum bootstrap-cell 4 =
[ 0 emit 0 emit ] when pad-bytes emit-bytes
] emit-object
] cache-eq-object ;


USING: byte-arrays io kernel sequences serialize
serialize.private ;

M: byte-array (serialize)
[
65 write1
[ add-object ] [ length serialize-cell ] [ write ] tri
] serialize-shared ;


USING: byte-arrays opencl.private ;

M: byte-array bind-kernel-arg bind-kernel-arg-data ;


USING: byte-arrays math.bitwise math.bitwise.private ;

M: byte-array bit-count byte-array-bit-count ;


USING: byte-arrays kernel ;

M: byte-array clone (clone) ; inline


USING: alien.c-types alien.data byte-arrays kernel
specialized-arrays.private ;

M: byte-array direct-like drop uchar <c-direct-array> ; inline


USING: alien alien.data arrays byte-arrays destructors kernel
libc math sequences tools.disassembler ;

M: byte-array disassemble
[
[ malloc-byte-array &free alien-address dup ]
[ length + ] bi 2array disassemble
] with-destructors ;


USING: alien byte-arrays kernel ;

M: byte-array element-size drop 1 ; inline


USING: byte-arrays kernel sequences ;

M: byte-array equal?
over byte-array? [ sequence= ] [ 2drop f ] if ;


USING: byte-arrays tools.hexdump tools.hexdump.private ;

M: byte-array hexdump. hexdump-bytes ;


USING: accessors byte-arrays sequences ;

M: byte-array length length>> ; inline


USING: accessors byte-arrays byte-vectors kernel sequences ;

M: byte-array like
drop dup byte-array? [
dup byte-vector? [
[ length ] [ underlying>> ] bi 2dup length eq?
[ nip ] [ resize-byte-array ] if
] [ >byte-array ] if
] unless ; inline


USING: byte-arrays images.loader io.encodings.binary
io.streams.byte-array kernel ;

M: byte-array load-image*
[ binary <byte-reader> ] dip stream>image ;


USING: byte-arrays game.models.loader io.streams.byte-array
kernel ;

M: byte-array load-models*
[ <byte-reader> ] dip stream>models ;


USING: byte-arrays byte-vectors kernel sequences ;

M: byte-array new-resizable drop <byte-vector> ; inline


USING: byte-arrays kernel sequences ;

M: byte-array new-sequence drop (byte-array) ; inline


USING: alien byte-arrays specialized-arrays.private ;

M: byte-array nth-c-ptr <displaced-alien> ; inline


USING: alien.accessors byte-arrays kernel math
sequences.private ;

M: byte-array nth-unsafe
swap integer>fixnum alien-unsigned-1 ; inline


USING: byte-arrays syndication xml xml.entities.html ;

M: byte-array parse-feed
[ bytes>xml xml>feed ] with-html-entities ;


USING: byte-arrays kernel prettyprint.custom ;

M: byte-array pprint-delims drop \ B{ \ } ;


USING: byte-arrays sequences.private ;

M: byte-array resize resize-byte-array ; inline


USING: alien.accessors byte-arrays kernel math
sequences.private ;

M: byte-array set-nth-unsafe
swap integer>fixnum set-alien-unsigned-1 ; inline


USING: byte-arrays math.parser sequences smalltalk.printer ;

M: byte-array smalltalk>string
[ number>string ] { } map-as " " join "#[" "]" surround ;


USING: alien.strings byte-arrays ;

M: byte-array symbol>string (symbol>string) ;


USING: accessors byte-arrays db.queries db.types kernel nmake ;

M: byte-array where over column-name>> 0% " = " 0% bind# ;