I/O encodings
Factor handbook » Input and output

Prev:An introduction to encodings
Next:Duplex streams


The io.encodings vocabulary provides utilities for encoding and decoding bytes that represent text. Encodings can be used in the following situations:
With binary input streams, to convert bytes to characters
With binary output streams, to convert characters to bytes
With byte arrays, to convert bytes to characters
With strings, to convert characters to bytes

Encoding descriptors
Manually constructing an encoded stream
Encoding and decoding strings

New types of encodings can be defined:
Encoding protocol

Setting encodings on the current streams:
encode-output ( encoding -- )

decode-input ( encoding -- )


Setting encodings on streams:
re-encode ( stream encoding -- newstream )

re-decode ( stream encoding -- newstream )


Combinators to change the encoding:
with-encoded-output ( encoding quot -- )

with-decoded-input ( encoding quot -- )


See also
An introduction to encodings