azure-docs-sdk-java/docs-ref-autogen/com.azure.core.amqp.models....

128 строки
19 KiB
YAML

### 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:
- "<xref href=\"java.lang.Object?displayProperty=fullName\" data-throw-if-not-resolved=\"False\" />"
inheritedClassMethods:
- classRef: "java.lang.<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html\">Object</a>"
methodsRef:
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--\">clone</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-\">equals</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--\">finalize</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--\">getClass</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--\">hashCode</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--\">notify</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--\">notifyAll</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--\">toString</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--\">wait</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-\">wait</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-\">wait</a>"
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 <xref uid=\"com.azure.core.amqp.models.AmqpMessageBody\" data-throw-if-not-resolved=\"false\" data-raw-source=\"AmqpMessageBody\"></xref> with given byte array."
modifiers:
- "static"
parameters:
- description: "used to create another instance of <xref uid=\"com.azure.core.amqp.models.AmqpMessageBody\" data-throw-if-not-resolved=\"false\" data-raw-source=\"AmqpMessageBody\"></xref>."
name: "data"
type: "<xref href=\"byte?alt=byte&text=byte\" data-throw-if-not-resolved=\"False\" />[]"
syntax: "public static AmqpMessageBody fromData(byte[] data)"
desc: "Creates instance of <xref uid=\"com.azure.core.amqp.models.AmqpMessageBody\" data-throw-if-not-resolved=\"false\" data-raw-source=\"AmqpMessageBody\"></xref> with given byte array."
returns:
description: "AmqpMessageBody Newly created instance."
type: "<xref href=\"com.azure.core.amqp.models.AmqpMessageBody?alt=com.azure.core.amqp.models.AmqpMessageBody&text=AmqpMessageBody\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.core.amqp.models.AmqpMessageBody.fromSequence(java.util.List<java.lang.Object>)"
fullName: "com.azure.core.amqp.models.AmqpMessageBody.fromSequence(List<Object> sequence)"
name: "fromSequence(List<Object> sequence)"
nameWithType: "AmqpMessageBody.fromSequence(List<Object> sequence)"
summary: "Creates an instance of <xref uid=\"com.azure.core.amqp.models.AmqpMessageBody\" data-throw-if-not-resolved=\"false\" data-raw-source=\"AmqpMessageBody\"></xref> with the given <xref uid=\"java.util.List\" data-throw-if-not-resolved=\"false\" data-raw-source=\"sequence\"></xref>."
modifiers:
- "static"
parameters:
- description: "used to create an instance of <xref uid=\"com.azure.core.amqp.models.AmqpMessageBody\" data-throw-if-not-resolved=\"false\" data-raw-source=\"AmqpMessageBody\"></xref>. A sequence can be <xref uid=\"java.util.List\" data-throw-if-not-resolved=\"false\" data-raw-source=\"List\"></xref> of\n <xref uid=\"java.lang.Object\" data-throw-if-not-resolved=\"false\" data-raw-source=\"objects\"></xref>. The <xref uid=\"java.lang.Object\" data-throw-if-not-resolved=\"false\" data-raw-source=\"object\"></xref> can be any of the AMQP supported primitive data type."
name: "sequence"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/util/List.html\">List</a>&lt;<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html\">Object</a>&gt;"
syntax: "public static AmqpMessageBody fromSequence(List<Object> sequence)"
desc: "Creates an instance of <xref uid=\"com.azure.core.amqp.models.AmqpMessageBody\" data-throw-if-not-resolved=\"false\" data-raw-source=\"AmqpMessageBody\"></xref> with the given <xref uid=\"java.util.List\" data-throw-if-not-resolved=\"false\" data-raw-source=\"sequence\"></xref>. It supports only one `sequence` at present."
returns:
description: "newly created instance of <xref uid=\"com.azure.core.amqp.models.AmqpMessageBody\" data-throw-if-not-resolved=\"false\" data-raw-source=\"AmqpMessageBody\"></xref>."
type: "<xref href=\"com.azure.core.amqp.models.AmqpMessageBody?alt=com.azure.core.amqp.models.AmqpMessageBody&text=AmqpMessageBody\" data-throw-if-not-resolved=\"False\" />"
- 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 <xref uid=\"com.azure.core.amqp.models.AmqpMessageBody\" data-throw-if-not-resolved=\"false\" data-raw-source=\"AmqpMessageBody\"></xref> with the given <xref uid=\"java.lang.Object\" data-throw-if-not-resolved=\"false\" data-raw-source=\"value\"></xref>."
modifiers:
- "static"
parameters:
- description: "used to create an instance of <xref uid=\"com.azure.core.amqp.models.AmqpMessageBody\" data-throw-if-not-resolved=\"false\" data-raw-source=\"AmqpMessageBody\"></xref>."
name: "value"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html\">Object</a>"
syntax: "public static AmqpMessageBody fromValue(Object value)"
desc: "Creates an instance of <xref uid=\"com.azure.core.amqp.models.AmqpMessageBody\" data-throw-if-not-resolved=\"false\" data-raw-source=\"AmqpMessageBody\"></xref> with the given <xref uid=\"java.lang.Object\" data-throw-if-not-resolved=\"false\" data-raw-source=\"value\"></xref>. A value can be any of the AMQP supported primitive data type."
returns:
description: "newly created instance of <xref uid=\"com.azure.core.amqp.models.AmqpMessageBody\" data-throw-if-not-resolved=\"false\" data-raw-source=\"AmqpMessageBody\"></xref>."
type: "<xref href=\"com.azure.core.amqp.models.AmqpMessageBody?alt=com.azure.core.amqp.models.AmqpMessageBody&text=AmqpMessageBody\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.core.amqp.models.AmqpMessageBody.getBodyType()"
fullName: "com.azure.core.amqp.models.AmqpMessageBody.getBodyType()"
name: "getBodyType()"
nameWithType: "AmqpMessageBody.getBodyType()"
summary: "Gets the <xref uid=\"com.azure.core.amqp.models.AmqpMessageBodyType\" data-throw-if-not-resolved=\"false\" data-raw-source=\"AmqpMessageBodyType\"></xref> of the message."
syntax: "public AmqpMessageBodyType getBodyType()"
desc: "Gets the <xref uid=\"com.azure.core.amqp.models.AmqpMessageBodyType\" data-throw-if-not-resolved=\"false\" data-raw-source=\"AmqpMessageBodyType\"></xref> of the message.\n\n**How to check for <xref uid=\"com.azure.core.amqp.models.AmqpMessageBodyType\" data-throw-if-not-resolved=\"false\" data-raw-source=\"AmqpMessageBodyType\"></xref>**\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<Object> 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: "<xref href=\"com.azure.core.amqp.models.AmqpMessageBodyType?alt=com.azure.core.amqp.models.AmqpMessageBodyType&text=AmqpMessageBodyType\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.core.amqp.models.AmqpMessageBody.getData()"
fullName: "com.azure.core.amqp.models.AmqpMessageBody.getData()"
name: "getData()"
nameWithType: "AmqpMessageBody.getData()"
summary: "Gets an <xref uid=\"com.azure.core.util.IterableStream\" data-throw-if-not-resolved=\"false\" data-raw-source=\"IterableStream\"></xref> of byte array containing only first byte array set on this <xref uid=\"com.azure.core.amqp.models.AmqpMessageBody\" data-throw-if-not-resolved=\"false\" data-raw-source=\"AmqpMessageBody\"></xref>."
syntax: "public IterableStream<byte[]> getData()"
desc: "Gets an <xref uid=\"com.azure.core.util.IterableStream\" data-throw-if-not-resolved=\"false\" data-raw-source=\"IterableStream\"></xref> of byte array containing only first byte array set on this <xref uid=\"com.azure.core.amqp.models.AmqpMessageBody\" data-throw-if-not-resolved=\"false\" data-raw-source=\"AmqpMessageBody\"></xref>. This library only support one byte array at present, so the returned list will have only one element.\n\n**Client should test for <xref uid=\"com.azure.core.amqp.models.AmqpMessageBodyType\" data-throw-if-not-resolved=\"false\" data-raw-source=\"AmqpMessageBodyType\"></xref> before calling corresponding get method. Get methods not corresponding to the type of the body throws exception.**\n\n**How to check for <xref uid=\"com.azure.core.amqp.models.AmqpMessageBodyType\" data-throw-if-not-resolved=\"false\" data-raw-source=\"AmqpMessageBodyType\"></xref>**\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<Object> 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 <xref uid=\"com.azure.core.amqp.models.AmqpMessageBody\" data-throw-if-not-resolved=\"false\" data-raw-source=\"AmqpMessageBody\"></xref>."
type: "<xref href=\"com.azure.core.util.IterableStream?alt=com.azure.core.util.IterableStream&text=IterableStream\" data-throw-if-not-resolved=\"False\" />&lt;<xref href=\"byte?alt=byte&text=byte\" data-throw-if-not-resolved=\"False\" />[]&gt;"
- 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 <xref uid=\"com.azure.core.amqp.models.AmqpMessageBody\" data-throw-if-not-resolved=\"false\" data-raw-source=\"AmqpMessageBody\"></xref>."
syntax: "public byte[] getFirstData()"
desc: "Gets first byte array set on this <xref uid=\"com.azure.core.amqp.models.AmqpMessageBody\" data-throw-if-not-resolved=\"false\" data-raw-source=\"AmqpMessageBody\"></xref>. This library only support one byte array on Amqp Message at present.\n\n**Client should test for <xref uid=\"com.azure.core.amqp.models.AmqpMessageBodyType\" data-throw-if-not-resolved=\"false\" data-raw-source=\"AmqpMessageBodyType\"></xref> before calling corresponding get method. Get methods not corresponding to the type of the body throws exception.**\n\n**How to check for <xref uid=\"com.azure.core.amqp.models.AmqpMessageBodyType\" data-throw-if-not-resolved=\"false\" data-raw-source=\"AmqpMessageBodyType\"></xref>**\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<Object> 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 <xref uid=\"com.azure.core.amqp.models.AmqpMessageBody\" data-throw-if-not-resolved=\"false\" data-raw-source=\"AmqpMessageBody\"></xref>."
type: "<xref href=\"byte?alt=byte&text=byte\" data-throw-if-not-resolved=\"False\" />[]"
- 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 <xref uid=\"com.azure.core.amqp.models.AmqpMessageBody\" data-throw-if-not-resolved=\"false\" data-raw-source=\"AmqpMessageBody\"></xref>."
syntax: "public List<Object> getSequence()"
desc: "Gets the unmodifiable AMQP Sequence set on this <xref uid=\"com.azure.core.amqp.models.AmqpMessageBody\" data-throw-if-not-resolved=\"false\" data-raw-source=\"AmqpMessageBody\"></xref>. It support only one `sequence` at present.\n\n**Client should test for <xref uid=\"com.azure.core.amqp.models.AmqpMessageBodyType\" data-throw-if-not-resolved=\"false\" data-raw-source=\"AmqpMessageBodyType\"></xref> before calling corresponding get method. Get methods not corresponding to the type of the body throws exception.**\n\n**How to check for <xref uid=\"com.azure.core.amqp.models.AmqpMessageBodyType\" data-throw-if-not-resolved=\"false\" data-raw-source=\"AmqpMessageBodyType\"></xref>**\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<Object> 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 <xref uid=\"com.azure.core.amqp.models.AmqpMessageBody\" data-throw-if-not-resolved=\"false\" data-raw-source=\"AmqpMessageBody\"></xref> instance."
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/util/List.html\">List</a>&lt;<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html\">Object</a>&gt;"
- 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 <xref uid=\"com.azure.core.amqp.models.AmqpMessageBody\" data-throw-if-not-resolved=\"false\" data-raw-source=\"AmqpMessageBody\"></xref> instance."
syntax: "public Object getValue()"
desc: "Gets the AMQP value set on this <xref uid=\"com.azure.core.amqp.models.AmqpMessageBody\" data-throw-if-not-resolved=\"false\" data-raw-source=\"AmqpMessageBody\"></xref> instance. It can be any of the primitive AMQP data type.\n\n**Client should test for <xref uid=\"com.azure.core.amqp.models.AmqpMessageBodyType\" data-throw-if-not-resolved=\"false\" data-raw-source=\"AmqpMessageBodyType\"></xref> before calling corresponding get method. The 'Get' methods not corresponding to the type of the body throws exception.**\n\n**How to check for <xref uid=\"com.azure.core.amqp.models.AmqpMessageBodyType\" data-throw-if-not-resolved=\"false\" data-raw-source=\"AmqpMessageBodyType\"></xref>**\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<Object> 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 <xref uid=\"com.azure.core.amqp.models.AmqpMessageBody\" data-throw-if-not-resolved=\"false\" data-raw-source=\"AmqpMessageBody\"></xref> instance."
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html\">Object</a>"
type: "class"
desc: "This class encapsulates the body of a message. The <xref uid=\"com.azure.core.amqp.models.AmqpMessageBodyType\" data-throw-if-not-resolved=\"false\" data-raw-source=\"AmqpMessageBodyType\"></xref> map to an AMQP specification message body types. Current implementation support <xref uid=\"com.azure.core.amqp.models.AmqpMessageBodyType.DATA\" data-throw-if-not-resolved=\"false\" data-raw-source=\"DATA\"></xref> AMQP data type.\n\n**Client should test for <xref uid=\"com.azure.core.amqp.models.AmqpMessageBodyType\" data-throw-if-not-resolved=\"false\" data-raw-source=\"AmqpMessageBodyType\"></xref> before calling corresponding get method. Get methods not corresponding to the type of the body throws exception.**\n\n**How to check for <xref uid=\"com.azure.core.amqp.models.AmqpMessageBodyType\" data-throw-if-not-resolved=\"false\" data-raw-source=\"AmqpMessageBodyType\"></xref>**\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<Object> 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