writeBinHeader method

void writeBinHeader(
  1. int length
)

Implementation

void writeBinHeader(int length) {
  // When we write the header, we'll ask for all the space we need for the payload as well
  // as that may help ensure we only allocate a buffer once.
  if (length <= _maxUint8) {
    _bytesBuilder.add(<int>[MessagePackCode.bin8, length]);
  } else if (length <= _maxUint16) {
    _bytesBuilder.addByte(MessagePackCode.bin16);
    _writeBigEndianShort(length);
  } else {
    _bytesBuilder.addByte(MessagePackCode.bin32);
    _writeBigEndianInt(length);
  }
}