tryReadMapHeader method

int? tryReadMapHeader()

Implementation

int? tryReadMapHeader() {
  int? code = _reader.tryReadUint8();
  if (code == null) {
    return null;
  }

  switch (code) {
    case MessagePackCode.map16:
      return _reader.tryReadUint16();
    case MessagePackCode.map32:
      return _reader.tryReadInt32();
    default:
      if (code >= MessagePackCode.minFixMap &&
          code <= MessagePackCode.maxFixMap) {
        return code & 0xF;
      }

      throw _throwInvalidCode(code);
  }
}