|
|||||
|
||||||
Related Syntax | Other Library Functions |
function |
base64.writer |
Library: Character encodings, Base 64 (OMFFBASE64)
Import: omffbase64.xmd |
Return type: output Returns: A writable output target for streaming data. |
export external output function writer width value integer line-width optional initial {76} into value output output-data
Use writer
to accept raw binary data and write that data to a value output, heralded by from
, converted from binary data to a Base 64 encoding. That is, the program writes binary data, but the provided output receives Base 64.
writer
has an optional first argument, heralded by width
, that is the line width of the Base 64 output. The default is 76, in keeping with the specification for Base 64 encoding. The Base 64 output has line breaks, represented by a carriage-return/line-feed (CR+LF) sequence at most every that many characters (of the Base 64 encoding). The Base 64 output always has a CR+LF at its end.
The optional first argument of writer can alternatively have a value of zero (0), in which case no CR+LF sequences are produced, and the output consists entirely of encoded data.
To use omffbase64, you must import it into your program using a statement like this:
import "omffbase64.xmd" prefixed by base64.
(Please see the import
topic
for more on importing.)
; Write a provided header and the associated data as an email ; attachment body, with the data converted to BASE64 encoding. ; The encoded data needs to be buffered because it is being ; incorporated in an output into which other data is being ; written. import "omffbase64.xmd" prefixed by base64. import "omiobuf.xmd" prefixed by io. define function write-attachment (value stream header, value stream data) as local io.buffer buf set base64.writer into io.writer of buf to data output header || "%16r{0D,0A}" || io.reader of buf
Related Syntax base64.reader |
Other Library Functions base64.reader base64.writer |