This section describes binary input ports that read their input from given bytevectors, and binary output ports that accumulate their output and return it as a bytevector.
Takes a bytevector and returns a binary input port that delivers bytes from the bytevector. If the bytevector is modified, the effect is unspecified.
The optional arguments start and end may be used to
specify that the bytevector port delivers bytes from a portion of
bytevector; if not given, start defaults to
end defaults to
Returns a binary output port that will accumulate bytes for retrieval
It is an error if port was not created with open-output-bytevector.
Returns a bytevector consisting of the bytes that have been output to the port so far in the order they were output. If the result bytevector is modified, the effect is unspecified.
The procedure is called with one argument, a binary output port.
The values yielded by procedure are ignored. When
the port’s accumulated output as a newly allocated bytevector.
This procedure could have been defined as follows:
(define (call-with-output-bytevector procedure) (let ((port (open-output-bytevector))) (procedure port) (get-output-bytevector port)))