write-cbor ( obj -- ) - Factor Documentation

write-cbor ( obj -- )
Concise Binary Object Representation (CBOR)



Vocabulary
cbor

Inputs
obj an object


Outputs
None

Word description
Encodes an object into the CBOR format, writing to an output-stream .

Definition
IN: cbor

GENERIC: write-cbor ( obj -- )


Methods
USING: cbor io kernel ;

M: +cbor-nil+ write-cbor drop 246 write1 ;


USING: cbor io kernel ;

M: +cbor-undefined+ write-cbor drop 247 write1 ;


USING: assocs cbor cbor.private kernel ;

M: assoc write-cbor
dup assoc-size 5 write-integer
[ [ write-cbor ] bi@ ] assoc-each ;


USING: byte-arrays cbor cbor.private io kernel sequences ;

M: byte-array write-cbor dup length 2 write-integer write ;


USING: accessors cbor cbor.private ;

M: cbor-simple write-cbor value>> 7 write-integer ;


USING: accessors cbor cbor.private kernel ;

M: cbor-tagged write-cbor
dup tag>> 6 write-integer item>> write-cbor ;


USING: cbor io kernel ;

M: f write-cbor drop 244 write1 ;


USING: cbor endian io math ;

M: float write-cbor 251 write1 double>bits 8 >be write ;


USING: cbor cbor.private kernel math ;

M: integer write-cbor
dup 0 >= [ 0 write-integer ] [ neg 1 - 1 write-integer ] if
;


USING: cbor cbor.private kernel sequences ;

M: sequence write-cbor
dup length 4 write-integer [ write-cbor ] each ;


USING: cbor cbor.private io io.encodings.string
io.encodings.utf8 kernel sequences strings ;

M: string write-cbor
dup length 3 write-integer utf8 encode write ;


USING: cbor io kernel ;

M: t write-cbor drop 245 write1 ;


USING: calendar calendar.format cbor cbor.private ;

M: timestamp write-cbor
0 6 write-integer timestamp>rfc3339 write-cbor ;


USING: cbor cbor.private present urls ;

M: url write-cbor 32 6 write-integer present write-cbor ;

AltStyle によって変換されたページ (->オリジナル) /