chickadee » chicken » port » make-binary-output-port

make-output-port WRITE CLOSE #!key force-outputprocedure
make-binary-output-port WRITE CLOSE #!key force-output write-bytevectorprocedure

Returns a custom output port. Common operations on this port are handled by the given parameters, which should be procedures. WRITE is called when output is sent to the port and receives a single argument, a string (or bytevector for binary ports). CLOSE is called when the port is closed and should be a procedure of no arguments. force-output (if provided) is called for flushing the output port. The optional write-bytevector allows more optimized writing of partial buffers and takes 3 arguments: a bytevector, a starting position and an ending position.