WriteMapHeader writes a map header of the given size to the writer
(sz uint32)
| 322 | // WriteMapHeader writes a map header of the given |
| 323 | // size to the writer |
| 324 | func (mw *Writer) WriteMapHeader(sz uint32) error { |
| 325 | switch { |
| 326 | case sz <= 15: |
| 327 | return mw.push(wfixmap(uint8(sz))) |
| 328 | case sz <= math.MaxUint16: |
| 329 | return mw.prefix16(mmap16, uint16(sz)) |
| 330 | default: |
| 331 | return mw.prefix32(mmap32, sz) |
| 332 | } |
| 333 | } |
| 334 | |
| 335 | // WriteArrayHeader writes an array header of the |
| 336 | // given size to the writer |