This site is a static rendering of the Trac instance that was used by R7RS-WG1 for its work on R7RS-small (PDF), which was ratified in 2013. For more information, see Home. For a version of this page that may be more recent, see BinaryIoCowan in WG2's repo for R7RS-large.

Binary­Io­Cowan

cowan
2017-07-02 05:17:55
2history
source

Input and output

The default value of port is the current input or output port, as appropriate. It is an error if the ports passed to these procedures are not binary ports. The [type] values are defined in BytevectorsCowan.

(read-[type] [ port ])

Reads the appropriate number of bytes from port and returns a number of the appropriate type (exact integer or inexact real or complex number).

(write-[type] number [ port ])

Writes number to port in the appropriate format.

(read-ber-integer [ port ])

Reads a BER-encoded integer of arbitrary size from port and returns it as an exact integer.

(write-ber-integer exact-integer [ port ])

Writes exact-integer using BER encoding to port.

(read-utf8-string k [ port ])

(read-utf16-le-string k [ port ])

(read-utf16-be-string k [ port ])

Read k bytes from port, interpreting them as a sequence of characters encoded in UTF-8, UTF-16LE, or UTF-16BE, and return the sequence as a string. It is an error if the implementation forbids any of the characters in strings.

(write-utf8-string string [ port ])

(write-utf16-le-string string [ port ])

(write-utf16-be-string string' [ port'' ])

Convert the characters of string to UTF-8, UTF-16LE, or UTF-16BE, and write the bytes to port. It is an error if the implementation forbids any of the characters in strings.

(read-utf8-string-until byte [ port ])

Read bytes from port until a byte equal to byte is read. Discard the final byte, interpret all the other bytes as a sequence of characters encoded in UTF-8, and return the sequence as a string.