1 USING: arrays byte-arrays help.markup help.syntax kernel
\r
2 byte-vectors.private combinators ;
\r
5 ARTICLE: "byte-vectors" "Byte vectors"
\r
6 "A byte vector is a resizable mutable sequence of unsigned bytes. The literal syntax is covered in " { $link "syntax-byte-vectors" } ". Byte vector words are found in the " { $vocab-link "byte-vectors" } " vocabulary."
\r
8 "Byte vectors form a class:"
\r
9 { $subsection byte-vector }
\r
10 { $subsection byte-vector? }
\r
11 "Creating byte vectors:"
\r
12 { $subsection >byte-vector }
\r
13 { $subsection <byte-vector> }
\r
14 "If you don't care about initial capacity, a more elegant way to create a new byte vector is to write:"
\r
15 { $code "BV{ } clone" } ;
\r
17 ABOUT: "byte-vectors"
\r
20 { $description "The class of resizable byte vectors. See " { $link "syntax-byte-vectors" } " for syntax and " { $link "byte-vectors" } " for general information." } ;
\r
23 { $values { "n" "a positive integer specifying initial capacity" } { "byte-vector" byte-vector } }
\r
24 { $description "Creates a new byte vector that can hold " { $snippet "n" } " bytes before resizing." } ;
\r
27 { $values { "seq" "a sequence" } { "byte-vector" byte-vector } }
\r
28 { $description "Outputs a freshly-allocated byte vector with the same elements as a given sequence." }
\r
29 { $errors "Throws an error if the sequence contains elements other than integers." } ;
\r
31 HELP: byte-array>vector
\r
32 { $values { "byte-array" "an array" } { "length" "a non-negative integer" } { "byte-vector" byte-vector } }
\r
33 { $description "Creates a new byte vector using the array for underlying storage with the specified initial length." }
\r
34 { $warning "This word is in the " { $vocab-link "byte-vectors.private" } " vocabulary because it does not perform type or bounds checks. User code should call " { $link >byte-vector } " instead." } ;
\r