MCPcopy
hub / github.com/tinylib/msgp / WriteBytesHeader

Method WriteBytesHeader

msgp/write.go:474–483  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

472// of a MessagePack 'bin' object. The user is responsible
473// for then writing 'sz' more bytes into the stream.
474func (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
486func (mw *Writer) WriteBool(b bool) error {

Callers 3

TestReadBytesHeaderFunction · 0.95
TestReadWriteBytesHeaderFunction · 0.95
TestAppendBytesHeaderFunction · 0.95

Calls 3

prefix8Method · 0.95
prefix16Method · 0.95
prefix32Method · 0.95

Tested by 3

TestReadBytesHeaderFunction · 0.76
TestReadWriteBytesHeaderFunction · 0.76
TestAppendBytesHeaderFunction · 0.76