Handbook
Glossary
with-byte-writer ( encoding quot -- byte-array )
Factor handbook
»
Input and output
»
Byte-array streams
Prev:
with-byte-reader ( byte-array encoding quot -- )
Vocabulary
io
.
streams
.
byte-array
Inputs
encoding
an encoding descriptor
quot
a
quotation
Outputs
byte-array
a
byte-array
Word description
Calls the quotation in a new dynamic scope with
output-stream
rebound to an output stream writing data to a byte array using an encoding.
Definition
USING:
accessors
byte-arrays
io
io.encodings
kernel
;
IN:
io.streams.byte-array
:
with-byte-writer
( encoding quot -- byte-array )
[
<byte-writer>
]
dip
[
with-output-stream*
]
keepd
dup
encoder?
[
stream>>
]
when
>byte-array
;
inline