Chicken » Module (chicken bytevector)

## Module (chicken bytevector)

This module contains procedures for dealing with "bytevectors", fixed-size sequences of unsigned 8-bit integers.

### bytevector

bytevector FIXNUM ...procedure

  Returns a new bytevector containing the values `FIXNUM ...`.

### make-bytevector

make-bytevector SIZEprocedure

  Returns a bytevector object of SIZE bytes, aligned on an 8-byte boundary, uninitialized.

### bytevector?

bytevector? Xprocedure

  Returns `#t` if X is a bytevector object, or `#f` otherwise.

### bytevector-length

bytevector-length BYTEVECTORprocedure

  Returns the number of bytes in BYTEVECTOR.

### bytevector-u8-ref

bytevector-u8-ref BYTEVECTOR INDEXprocedure

  Returns the byte at INDEX in BYTEVECTOR.

### bytevector-u8-set!

bytevector-u8-set! BYTEVECTOR INDEX VALUEprocedure

  Destructively modifies the byte at INDEX in BYTEVECTOR to VALUE, which should be a fixnum.

### utf8->string

`(utf8->string BYTEVECTOR [START END])`procedure

  Returns a string with the contents of `BYTEVECTOR`. Invalid encodings for characters signal an error.

`(bytes->string BYTEVECTOR [START END])`procedure

  Similar to `utf8->string`, but accepts any byte sequence without validating the contents. Byte-sequences that are not representing valid UTF-8 characters are retained and, if extracted with `string-ref` are converted to a trailing surrogate pair half in the range U+DC80 to U+DCFF.

### string->utf8

string->utf8 STRINGprocedure

  Returns a bytevector with the contents of STRING.

### latin1->string

latin1->string BYTEVECTORprocedure

  Returns a string with the contents of BYTEVECTOR converted from Latin-1 (ISO-8859-1) encoding to UTF-8.

### string->latin1

string->latin1 STRINGprocedure

  Returns a bytevector with the contents of STRING encoded as Latin-1 (ISO-?8859-1).

### bytevector=?

bytevector=? BYTEVECTOR1 BYTEVECTOR2procedure

  Returns `#t` if the two argument bytevectors are of the same size and have the same content.

### bytevector-append

bytevector-append BYTEVECTOR ...procedure

  Returns a new bytevector holding the concatenated contents of all argument bytevectors.

### bytevector-copy

bytevector-copy BYTEVECTOR #!optional START ENDprocedure

  Returns a new bytevector holding the contents of BYTEVECTOR between the indices START to END.

### bytevector-copy!

bytevector-copy! TO AT FROM #!optional START ENDprocedure

  Copioes the contents of the bytevector FROM between the indices START to END into the bytevector TO, starting at index AT.

Previous: Module (chicken bitwise)

Next: Module (chicken condition)