get-bytevector-all - read bytes until the next end of file

LIBRARY

(import (rnrs))                     ;R6RS
(import (rnrs io ports))            ;R6RS

SYNOPSIS

(get-bytevector-all binary-input-port)

DESCRIPTION

Reads all bytes until the next end of file, blocking as necessary.

If one or more bytes are read, returns a bytevector containing all bytes up to the next end of file and updates binary-input-port to point just past these bytes.

If no bytes are read, returns the end-of-file object.

The operation may block indefinitely waiting to see if more bytes will become available, even if some bytes are already available.

RETURN VALUES

Returns a single value; a bytevector or the end-of-file object.

EXAMPLES

(call-with-port (open-file-input-port "/etc/machine-id")
  get-bytevector-all)

APPLICATION USAGE

This procedure is a convenience that replaces a loop that is fiddly to make efficient and correct.

COMPATIBILITY

This procedure is unique to R6RS.

ERRORS

This procedure can raise exceptions with the following condition types:
&assertion (R6RS)
The wrong number of arguments was passed or an argument was outside its domain.
R7RS
The assertions described above are errors. Implementations may signal an error, extend the procedure's domain of definition to include such arguments, or fail catastrophically.

SEE ALSO

get-bytevector-n(3scm),

STANDARDS

R6RS

HISTORY

This procedure first appeared in the reworked I/O system in R6RS.

AUTHORS

This page is part of the scheme-manpages project. It includes materials from the RnRS documents. More information can be found at https://github.com/schemedoc/manpages/.


Markup created by unroff 1.0sc,    March 04, 2023.