public PackType PeekNextType() { var markerByte = _in.PeekByte(); var markerHighNibble = (byte)(markerByte & 0xF0); switch (markerHighNibble) { case TINY_STRING: return(PackType.String); case TINY_LIST: return(PackType.List); case TINY_MAP: return(PackType.Map); case TINY_STRUCT: return(PackType.Struct); } if ((sbyte)markerByte >= MINUS_2_TO_THE_4) { return(PackType.Integer); } switch (markerByte) { case NULL: return(PackType.Null); case TRUE: case FALSE: return(PackType.Boolean); case FLOAT_64: return(PackType.Float); case BYTES_8: case BYTES_16: case BYTES_32: return(PackType.Bytes); case STRING_8: case STRING_16: case STRING_32: return(PackType.String); case LIST_8: case LIST_16: case LIST_32: return(PackType.List); case MAP_8: case MAP_16: case MAP_32: return(PackType.Map); case STRUCT_8: case STRUCT_16: return(PackType.Struct); case INT_8: case INT_16: case INT_32: case INT_64: return(PackType.Integer); default: throw new ArgumentOutOfRangeException(nameof(markerByte), markerByte, $"Unknown type 0x{markerByte.ToString("X2")}"); } }