read method
Reads the buffer contents
Implementation
@override
dynamic read() {
final u = readUInt8();
if (u <= 127) {
return u;
} else if ((u & 0xE0) == 0xE0) {
// negative small integer
return u - 256;
} else if ((u & 0xE0) == 0xA0) {
return readString(u & 0x1F);
} else if ((u & 0xF0) == 0x90) {
return readArray(u & 0xF);
} else if ((u & 0xF0) == 0x80) {
return _readMap(u & 0xF);
}
switch (u) {
case types.nil:
return null;
case types.boolFalse:
return false;
case types.boolTrue:
return true;
case types.bin8:
return readBuffer(readUInt8());
case types.bin16:
return readBuffer(readUInt16());
case types.bin32:
return readBuffer(readUInt32());
case types.ext8:
return _readExt(readUInt8());
case types.ext16:
return _readExt(readUInt16());
case types.ext32:
return _readExt(readUInt32());
case types.float32:
return readFloat32();
case types.float64:
return readFloat64();
case types.uint8:
return readUInt8();
case types.uin16:
return readUInt16();
case types.uint32:
return readUInt32();
case types.uint64:
return readUInt64();
case types.int8:
return readInt8();
case types.int16:
return readInt16();
case types.int32:
return readInt32();
case types.int64:
return readInt64();
case types.fixext1:
return _readExt(1);
case types.fixext2:
return _readExt(2);
case types.fixext4:
return _readExt(4);
case types.fixext8:
return _readExt(8);
case types.fixext16:
return _readExt(16);
case types.str8:
return readString(readUInt8());
case types.str16:
return readString(readUInt16());
case types.str32:
return readString(readUInt32());
case types.array16:
return readArray(readUInt16());
case types.array32:
return readArray(readUInt32());
case types.map16:
return _readMap(readUInt16());
case types.map32:
return _readMap(readUInt32());
default:
throw MsgPackUnsupportedTypeError(u);
}
}