### YamlMime:JavaType uid: "com.azure.core.amqp.models.AmqpMessageBody" fullName: "com.azure.core.amqp.models.AmqpMessageBody" name: "AmqpMessageBody" nameWithType: "AmqpMessageBody" summary: "This class encapsulates the body of a message." inheritances: - "" inheritedClassMethods: - classRef: "java.lang.Object" methodsRef: - "clone" - "equals" - "finalize" - "getClass" - "hashCode" - "notify" - "notifyAll" - "toString" - "wait" - "wait" - "wait" syntax: "public final class **AmqpMessageBody**" methods: - uid: "com.azure.core.amqp.models.AmqpMessageBody.fromData(byte[])" fullName: "com.azure.core.amqp.models.AmqpMessageBody.fromData(byte[] data)" name: "fromData(byte[] data)" nameWithType: "AmqpMessageBody.fromData(byte[] data)" summary: "Creates instance of with given byte array." modifiers: - "static" parameters: - description: "used to create another instance of ." name: "data" type: "[]" syntax: "public static AmqpMessageBody fromData(byte[] data)" desc: "Creates instance of with given byte array." returns: description: "AmqpMessageBody Newly created instance." type: "" - uid: "com.azure.core.amqp.models.AmqpMessageBody.fromSequence(java.util.List)" fullName: "com.azure.core.amqp.models.AmqpMessageBody.fromSequence(List sequence)" name: "fromSequence(List sequence)" nameWithType: "AmqpMessageBody.fromSequence(List sequence)" summary: "Creates an instance of with the given ." modifiers: - "static" parameters: - description: "used to create an instance of . A sequence can be of\n . The can be any of the AMQP supported primitive data type." name: "sequence" type: "List<Object>" syntax: "public static AmqpMessageBody fromSequence(List sequence)" desc: "Creates an instance of with the given . It supports only one `sequence` at present." returns: description: "newly created instance of ." type: "" - uid: "com.azure.core.amqp.models.AmqpMessageBody.fromValue(java.lang.Object)" fullName: "com.azure.core.amqp.models.AmqpMessageBody.fromValue(Object value)" name: "fromValue(Object value)" nameWithType: "AmqpMessageBody.fromValue(Object value)" summary: "Creates an instance of with the given ." modifiers: - "static" parameters: - description: "used to create an instance of ." name: "value" type: "Object" syntax: "public static AmqpMessageBody fromValue(Object value)" desc: "Creates an instance of with the given . A value can be any of the AMQP supported primitive data type." returns: description: "newly created instance of ." type: "" - uid: "com.azure.core.amqp.models.AmqpMessageBody.getBodyType()" fullName: "com.azure.core.amqp.models.AmqpMessageBody.getBodyType()" name: "getBodyType()" nameWithType: "AmqpMessageBody.getBodyType()" summary: "Gets the of the message." syntax: "public AmqpMessageBodyType getBodyType()" desc: "Gets the of the message.\n\n**How to check for **\n\n```java\nObject amqpValue;\n AmqpMessageBodyType bodyType = amqpAnnotatedMessage.getBody().getBodyType();\n\n switch (bodyType) {\n case DATA:\n byte[] payload = amqpAnnotatedMessage.getBody().getFirstData();\n System.out.println(new String(payload));\n break;\n case SEQUENCE:\n List sequenceData = amqpAnnotatedMessage.getBody().getSequence();\n sequenceData.forEach(System.out::println);\n break;\n case VALUE:\n amqpValue = amqpAnnotatedMessage.getBody().getValue();\n System.out.println(amqpValue);\n break;\n default:\n throw new RuntimeException(String.format(Locale.US, \"Body type [%s] is not valid.\", bodyType));\n }\n```" returns: description: "AmqpBodyType type of the message." type: "" - uid: "com.azure.core.amqp.models.AmqpMessageBody.getData()" fullName: "com.azure.core.amqp.models.AmqpMessageBody.getData()" name: "getData()" nameWithType: "AmqpMessageBody.getData()" summary: "Gets an of byte array containing only first byte array set on this ." syntax: "public IterableStream getData()" desc: "Gets an of byte array containing only first byte array set on this . This library only support one byte array at present, so the returned list will have only one element.\n\n**Client should test for before calling corresponding get method. Get methods not corresponding to the type of the body throws exception.**\n\n**How to check for **\n\n```java\nObject amqpValue;\n AmqpMessageBodyType bodyType = amqpAnnotatedMessage.getBody().getBodyType();\n\n switch (bodyType) {\n case DATA:\n byte[] payload = amqpAnnotatedMessage.getBody().getFirstData();\n System.out.println(new String(payload));\n break;\n case SEQUENCE:\n List sequenceData = amqpAnnotatedMessage.getBody().getSequence();\n sequenceData.forEach(System.out::println);\n break;\n case VALUE:\n amqpValue = amqpAnnotatedMessage.getBody().getValue();\n System.out.println(amqpValue);\n break;\n default:\n throw new RuntimeException(String.format(Locale.US, \"Body type [%s] is not valid.\", bodyType));\n }\n```" returns: description: "data set on ." type: "<[]>" - uid: "com.azure.core.amqp.models.AmqpMessageBody.getFirstData()" fullName: "com.azure.core.amqp.models.AmqpMessageBody.getFirstData()" name: "getFirstData()" nameWithType: "AmqpMessageBody.getFirstData()" summary: "Gets first byte array set on this ." syntax: "public byte[] getFirstData()" desc: "Gets first byte array set on this . This library only support one byte array on Amqp Message at present.\n\n**Client should test for before calling corresponding get method. Get methods not corresponding to the type of the body throws exception.**\n\n**How to check for **\n\n```java\nObject amqpValue;\n AmqpMessageBodyType bodyType = amqpAnnotatedMessage.getBody().getBodyType();\n\n switch (bodyType) {\n case DATA:\n byte[] payload = amqpAnnotatedMessage.getBody().getFirstData();\n System.out.println(new String(payload));\n break;\n case SEQUENCE:\n List sequenceData = amqpAnnotatedMessage.getBody().getSequence();\n sequenceData.forEach(System.out::println);\n break;\n case VALUE:\n amqpValue = amqpAnnotatedMessage.getBody().getValue();\n System.out.println(amqpValue);\n break;\n default:\n throw new RuntimeException(String.format(Locale.US, \"Body type [%s] is not valid.\", bodyType));\n }\n```" returns: description: "data set on ." type: "[]" - uid: "com.azure.core.amqp.models.AmqpMessageBody.getSequence()" fullName: "com.azure.core.amqp.models.AmqpMessageBody.getSequence()" name: "getSequence()" nameWithType: "AmqpMessageBody.getSequence()" summary: "Gets the unmodifiable AMQP Sequence set on this ." syntax: "public List getSequence()" desc: "Gets the unmodifiable AMQP Sequence set on this . It support only one `sequence` at present.\n\n**Client should test for before calling corresponding get method. Get methods not corresponding to the type of the body throws exception.**\n\n**How to check for **\n\n```java\nObject amqpValue;\n AmqpMessageBodyType bodyType = amqpAnnotatedMessage.getBody().getBodyType();\n\n switch (bodyType) {\n case DATA:\n byte[] payload = amqpAnnotatedMessage.getBody().getFirstData();\n System.out.println(new String(payload));\n break;\n case SEQUENCE:\n List sequenceData = amqpAnnotatedMessage.getBody().getSequence();\n sequenceData.forEach(System.out::println);\n break;\n case VALUE:\n amqpValue = amqpAnnotatedMessage.getBody().getValue();\n System.out.println(amqpValue);\n break;\n default:\n throw new RuntimeException(String.format(Locale.US, \"Body type [%s] is not valid.\", bodyType));\n }\n```" returns: description: "sequence of this instance." type: "List<Object>" - uid: "com.azure.core.amqp.models.AmqpMessageBody.getValue()" fullName: "com.azure.core.amqp.models.AmqpMessageBody.getValue()" name: "getValue()" nameWithType: "AmqpMessageBody.getValue()" summary: "Gets the AMQP value set on this instance." syntax: "public Object getValue()" desc: "Gets the AMQP value set on this instance. It can be any of the primitive AMQP data type.\n\n**Client should test for before calling corresponding get method. The 'Get' methods not corresponding to the type of the body throws exception.**\n\n**How to check for **\n\n```java\nObject amqpValue;\n AmqpMessageBodyType bodyType = amqpAnnotatedMessage.getBody().getBodyType();\n\n switch (bodyType) {\n case DATA:\n byte[] payload = amqpAnnotatedMessage.getBody().getFirstData();\n System.out.println(new String(payload));\n break;\n case SEQUENCE:\n List sequenceData = amqpAnnotatedMessage.getBody().getSequence();\n sequenceData.forEach(System.out::println);\n break;\n case VALUE:\n amqpValue = amqpAnnotatedMessage.getBody().getValue();\n System.out.println(amqpValue);\n break;\n default:\n throw new RuntimeException(String.format(Locale.US, \"Body type [%s] is not valid.\", bodyType));\n }\n```" returns: description: "value of this instance." type: "Object" type: "class" desc: "This class encapsulates the body of a message. The map to an AMQP specification message body types. Current implementation support AMQP data type.\n\n**Client should test for before calling corresponding get method. Get methods not corresponding to the type of the body throws exception.**\n\n**How to check for **\n\n```java\nObject amqpValue;\n AmqpMessageBodyType bodyType = amqpAnnotatedMessage.getBody().getBodyType();\n\n switch (bodyType) {\n case DATA:\n byte[] payload = amqpAnnotatedMessage.getBody().getFirstData();\n System.out.println(new String(payload));\n break;\n case SEQUENCE:\n List sequenceData = amqpAnnotatedMessage.getBody().getSequence();\n sequenceData.forEach(System.out::println);\n break;\n case VALUE:\n amqpValue = amqpAnnotatedMessage.getBody().getValue();\n System.out.println(amqpValue);\n break;\n default:\n throw new RuntimeException(String.format(Locale.US, \"Body type [%s] is not valid.\", bodyType));\n }\n```" metadata: {} package: "com.azure.core.amqp.models" artifact: com.azure:azure-core-amqp:2.9.9