| get-bytevector-all(3scm) | Scheme Programmer's Manual | get-bytevector-all(3scm) |
NAME
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.
- &i/o-read (R6RS)
- There was an I/O error during the read operation.
- &i/o-port (R6RS)
- This condition specifies the port object related to an &i/o-read condition.
- 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://weinholt.se/scheme/manpages/.
| 2023-02-01 |