4.4 Bytevectors
The (hoot bytevectors)
module provides some of the R6RS
bytevectors API. Bytevectors are sequences of bytes that are useful
for low-level manipulation of binary data.
- Procedure: make-bytevector len [init 0] ¶
Return a new bytevector of len bytes with all bytes initialized
to init.
- Procedure: bytevector [byte ...] ¶
Return a new bytevector containing the sequence byte ….
- Procedure: bytevector? obj ¶
Return #t
if obj is a bytevector.
- Procedure: bytevector-length bv ¶
Return the length of bv in bytes.
- Procedure: bytevector-copy bv [start 0] [end (bytevector-length bv)] ¶
Return a new bytevector that is a copy of the bytevector bv from
byte index start to end. start must be less than or
equal to end.
- Procedure: bytevector-copy! to at from [start 0] [end (bytevector-length from)] ¶
Copy the subsection of bytevector from, defined by the byte
range [start, end), into the bytevector from.
- Procedure: bytevector-append [bv ...] ¶
Return a new bytevector that concatenates all the input bytevectors
bv … in the order given.
- Procedure: bytevector-concatenate bvs ¶
Return a new bytevector that concatenates all of the bytevectors in
the list bvs.
- Procedure: bytevector-concatenate-reverse bvs ¶
Return a new bytevector that concatenates all of the bytevectors in
the list bvs in reverse order.
- Procedure: bytevector-u8-ref bv index ¶
- Procedure: bytevector-s8-ref bv index ¶
- Procedure: bytevector-u16-native-ref bv index ¶
- Procedure: bytevector-s16-native-ref bv index ¶
- Procedure: bytevector-u32-native-ref bv index ¶
- Procedure: bytevector-s32-native-ref bv index ¶
- Procedure: bytevector-u64-native-ref bv index ¶
- Procedure: bytevector-s64-native-ref bv index ¶
Return the N-bit signed or unsigned integer from the bytevector
bv at index using the host’s native endianness.
- Procedure: bytevector-ieee-single-native-ref bv index ¶
- Procedure: bytevector-ieee-double-native-ref bv index ¶
Return the single or double precision IEEE floating piont number from
the bytevector bv at index using the host’s native
endianness.
- Procedure: bytevector-u8-set! bv index x ¶
- Procedure: bytevector-s8-set! bv index x ¶
- Procedure: bytevector-u16-native-set! bv index x ¶
- Procedure: bytevector-s16-native-set! bv index x ¶
- Procedure: bytevector-u32-native-set! bv index x ¶
- Procedure: bytevector-s32-native-set! bv index x ¶
- Procedure: bytevector-u64-native-set! bv index x ¶
- Procedure: bytevector-s64-native-set! bv index x ¶
Store x as an N-bit signed or unsigned integer in the bytevector
bv at index using the host’s native endianness.
- Procedure: bytevector-ieee-single-native-set! bv index x ¶
- Procedure: bytevector-ieee-double-native-set! bv index x ¶
Store x as a single or double precision IEEE floating piont
number in the bytevector bv at index using the host’s
native endianness.