Internal writing methods Abstract method for writing the start of lists and sets. List and sets on the wire differ only by the type indicator.
(elemType TType, size int)
| 682 | // Abstract method for writing the start of lists and sets. List and sets on |
| 683 | // the wire differ only by the type indicator. |
| 684 | func (p *TCompactProtocol) writeCollectionBegin(elemType TType, size int) (int, error) { |
| 685 | if size <= 14 { |
| 686 | return 1, p.writeByteDirect(byte(int32(size<<4) | int32(p.getCompactType(elemType)))) |
| 687 | } |
| 688 | err := p.writeByteDirect(0xf0 | byte(p.getCompactType(elemType))) |
| 689 | if err != nil { |
| 690 | return 0, err |
| 691 | } |
| 692 | m, err := p.writeVarint32(int32(size)) |
| 693 | return 1 + m, err |
| 694 | } |
| 695 | |
| 696 | // Write an i32 as a varint. Results in 1-5 bytes on the wire. |
| 697 | // TODO(pomack): make a permanent buffer like writeVarint64? |
no test coverage detected