public int ReadInt32()

in src/NMS.AMQP/Message/NmsStreamMessage.cs [187:209]


        public int ReadInt32()
        {
            CheckWriteOnlyBody();
            CheckBytesInFlight();

            int result;
            object value = facade.Peek();
            if (value is int intValue)
                result = intValue;
            else if (value is short shortValue)
                result = shortValue;
            else if (value is byte byteValue)
                result = byteValue;
            else if (value is string stringValue && int.TryParse(stringValue, out var parsedValue))
                result = parsedValue;
            else if (value is null)
                throw new NullReferenceException("Cannot convert null value to int.");
            else
                throw new MessageFormatException("stream value: " + value.GetType().Name + " cannot be converted to int.");

            facade.Pop();
            return result;
        }