private string GetTextFromBody()

in src/NMS.AMQP/Provider/Amqp/Message/AmqpNmsTextMessageFacade.cs [41:61]


        private string GetTextFromBody()
        {
            RestrictedDescribed body = Message.BodySection;
            if (body == null)
                return null;
            if (body is Data data)
                return DecodeBinaryBody(data.Binary);
            if (body is AmqpValue amqpValue)
            {
                object value = amqpValue.Value;
                if (value == null)
                    return null;
                if (value is byte[] bytes)
                    return DecodeBinaryBody(bytes);
                if (value is string text)
                    return text;
                throw new IllegalStateException("Unexpected Amqp value content-type: " + value.GetType().FullName);
            }

            throw new IllegalStateException("Unexpected body content-type: " + body.GetType().FullName);
        }