WriteBytesHeader writes just the size header of a MessagePack 'bin' object. The user is responsible for then writing 'sz' more bytes into the stream.
(sz uint32)
| 472 | // of a MessagePack 'bin' object. The user is responsible |
| 473 | // for then writing 'sz' more bytes into the stream. |
| 474 | func (mw *Writer) WriteBytesHeader(sz uint32) error { |
| 475 | switch { |
| 476 | case sz <= math.MaxUint8: |
| 477 | return mw.prefix8(mbin8, uint8(sz)) |
| 478 | case sz <= math.MaxUint16: |
| 479 | return mw.prefix16(mbin16, uint16(sz)) |
| 480 | default: |
| 481 | return mw.prefix32(mbin32, sz) |
| 482 | } |
| 483 | } |
| 484 | |
| 485 | // WriteBool writes a bool to the writer |
| 486 | func (mw *Writer) WriteBool(b bool) error { |