644 строки
126 KiB
YAML
644 строки
126 KiB
YAML
### YamlMime:JavaType
|
|
uid: "com.azure.core.util.BinaryData"
|
|
fullName: "com.azure.core.util.BinaryData"
|
|
name: "BinaryData"
|
|
nameWithType: "BinaryData"
|
|
summary: "Binary<wbr>Data is a convenient data interchange class for use throughout the Azure SDK for Java."
|
|
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 **BinaryData**"
|
|
methods:
|
|
- uid: "com.azure.core.util.BinaryData.<T>toObject(com.azure.core.util.serializer.TypeReference<T>)"
|
|
fullName: "com.azure.core.util.BinaryData.toObject(TypeReference<T> typeReference)"
|
|
name: "toObject(TypeReference<T> typeReference)"
|
|
nameWithType: "BinaryData.toObject(TypeReference<T> typeReference)"
|
|
summary: "Returns an <xref uid=\"java.lang.Object\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Object\"></xref> representation of this <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> by deserializing its data using the default <xref uid=\"com.azure.core.util.serializer.JsonSerializer\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonSerializer\"></xref>."
|
|
parameters:
|
|
- description: "The <xref uid=\"com.azure.core.util.serializer.TypeReference\" data-throw-if-not-resolved=\"false\" data-raw-source=\"TypeReference\"></xref> representing the Object's type."
|
|
name: "typeReference"
|
|
type: "<xref href=\"com.azure.core.util.serializer.TypeReference?alt=com.azure.core.util.serializer.TypeReference&text=TypeReference\" data-throw-if-not-resolved=\"False\" /><<xref href=\"T?alt=T&text=T\" data-throw-if-not-resolved=\"False\" />>"
|
|
syntax: "public T <T>toObject(TypeReference<T> typeReference)"
|
|
desc: "Returns an <xref uid=\"java.lang.Object\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Object\"></xref> representation of this <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> by deserializing its data using the default <xref uid=\"com.azure.core.util.serializer.JsonSerializer\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonSerializer\"></xref>. Each time this method is called, the content is deserialized and a new instance of type `T` is returned. So, calling this method repeatedly to convert the underlying data source into the same type is not recommended.\n\nThe type, represented by <xref uid=\"com.azure.core.util.serializer.TypeReference\" data-throw-if-not-resolved=\"false\" data-raw-source=\"TypeReference\"></xref>, can either be a generic or non-generic type. If the type is generic create a sub-type of <xref uid=\"com.azure.core.util.serializer.TypeReference\" data-throw-if-not-resolved=\"false\" data-raw-source=\"TypeReference\"></xref>, if the type is non-generic use <xref uid=\"com.azure.core.util.serializer.TypeReference.<T>createInstance(java.lang.Class<T>)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"TypeReference#createInstance(Class)\"></xref>.\n\n**Note:** This method first looks for a <xref uid=\"com.azure.core.util.serializer.JsonSerializerProvider\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonSerializerProvider\"></xref> implementation on the classpath. If no implementation is found, a default Jackson-based implementation will be used to deserialize the object.\n\n**Get a non-generic Object from the BinaryData**\n\n```java\nfinal Person data = new Person().setName(\"John\");\n\n // Ensure your classpath have the Serializer to serialize the object which implement implement\n // com.azure.core.util.serializer.JsonSerializer interface.\n // Or use Azure provided libraries for this.\n // https://central.sonatype.com/artifact/com.azure/azure-core-serializer-json-jackson or\n // https://central.sonatype.com/artifact/com.azure/azure-core-serializer-json-gson\n\n BinaryData binaryData = BinaryData.fromObject(data);\n\n Person person = binaryData.toObject(TypeReference.createInstance(Person.class));\n System.out.println(person.getName());\n```\n\n**Get a generic Object from the BinaryData**\n\n```java\nfinal Person person1 = new Person().setName(\"John\");\n final Person person2 = new Person().setName(\"Jack\");\n\n List<Person> personList = new ArrayList<>();\n personList.add(person1);\n personList.add(person2);\n\n // Ensure your classpath have the Serializer to serialize the object which implement implement\n // com.azure.core.util.serializer.JsonSerializer interface.\n // Or use Azure provided libraries for this.\n // https://central.sonatype.com/artifact/com.azure/azure-core-serializer-json-jackson or\n // https://central.sonatype.com/artifact/com.azure/azure-core-serializer-json-gson\n\n\n BinaryData binaryData = BinaryData.fromObject(personList);\n\n List<Person> persons = binaryData.toObject(new TypeReference<List<Person>>() { });\n persons.forEach(person -> System.out.println(person.getName()));\n```"
|
|
returns:
|
|
description: "An <xref uid=\"java.lang.Object\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Object\"></xref> representing the JSON deserialized <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref>."
|
|
type: "<xref href=\"T?alt=T&text=T\" data-throw-if-not-resolved=\"False\" />"
|
|
- uid: "com.azure.core.util.BinaryData.<T>toObject(com.azure.core.util.serializer.TypeReference<T>,com.azure.core.util.serializer.ObjectSerializer)"
|
|
fullName: "com.azure.core.util.BinaryData.toObject(TypeReference<T> typeReference, ObjectSerializer serializer)"
|
|
name: "toObject(TypeReference<T> typeReference, ObjectSerializer serializer)"
|
|
nameWithType: "BinaryData.toObject(TypeReference<T> typeReference, ObjectSerializer serializer)"
|
|
summary: "Returns an <xref uid=\"java.lang.Object\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Object\"></xref> representation of this <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> by deserializing its data using the passed <xref uid=\"com.azure.core.util.serializer.ObjectSerializer\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ObjectSerializer\"></xref>."
|
|
parameters:
|
|
- description: "The <xref uid=\"com.azure.core.util.serializer.TypeReference\" data-throw-if-not-resolved=\"false\" data-raw-source=\"TypeReference\"></xref> representing the Object's type."
|
|
name: "typeReference"
|
|
type: "<xref href=\"com.azure.core.util.serializer.TypeReference?alt=com.azure.core.util.serializer.TypeReference&text=TypeReference\" data-throw-if-not-resolved=\"False\" /><<xref href=\"T?alt=T&text=T\" data-throw-if-not-resolved=\"False\" />>"
|
|
- description: "The <xref uid=\"com.azure.core.util.serializer.ObjectSerializer\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ObjectSerializer\"></xref> used to deserialize object."
|
|
name: "serializer"
|
|
type: "<xref href=\"com.azure.core.util.serializer.ObjectSerializer?alt=com.azure.core.util.serializer.ObjectSerializer&text=ObjectSerializer\" data-throw-if-not-resolved=\"False\" />"
|
|
syntax: "public T <T>toObject(TypeReference<T> typeReference, ObjectSerializer serializer)"
|
|
desc: "Returns an <xref uid=\"java.lang.Object\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Object\"></xref> representation of this <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> by deserializing its data using the passed <xref uid=\"com.azure.core.util.serializer.ObjectSerializer\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ObjectSerializer\"></xref>. Each time this method is called, the content is deserialized and a new instance of type `T` is returned. So, calling this method repeatedly to convert the underlying data source into the same type is not recommended.\n\nThe type, represented by <xref uid=\"com.azure.core.util.serializer.TypeReference\" data-throw-if-not-resolved=\"false\" data-raw-source=\"TypeReference\"></xref>, can either be a generic or non-generic type. If the type is generic create a sub-type of <xref uid=\"com.azure.core.util.serializer.TypeReference\" data-throw-if-not-resolved=\"false\" data-raw-source=\"TypeReference\"></xref>, if the type is non-generic use <xref uid=\"com.azure.core.util.serializer.TypeReference.<T>createInstance(java.lang.Class<T>)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"TypeReference#createInstance(Class)\"></xref>.\n\nThe passed <xref uid=\"com.azure.core.util.serializer.ObjectSerializer\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ObjectSerializer\"></xref> can either be one of the implementations offered by the Azure SDKs or your own implementation.\n\n**Azure SDK implementations**\n\n * [Jackson JSON serializer][]\n * [GSON JSON serializer][]\n\n**Get a non-generic Object from the BinaryData**\n\n```java\nfinal Person data = new Person().setName(\"John\");\n\n // Provide your custom serializer or use Azure provided serializers.\n // https://central.sonatype.com/artifact/com.azure/azure-core-serializer-json-jackson or\n // https://central.sonatype.com/artifact/com.azure/azure-core-serializer-json-gson\n\n final ObjectSerializer serializer = new MyJsonSerializer(); // Replace this with your Serializer\n BinaryData binaryData = BinaryData.fromObject(data, serializer);\n\n Person person = binaryData.toObject(TypeReference.createInstance(Person.class), serializer);\n System.out.println(\"Name : \" + person.getName());\n```\n\n**Get a generic Object from the BinaryData**\n\n```java\nfinal Person person1 = new Person().setName(\"John\");\n final Person person2 = new Person().setName(\"Jack\");\n\n List<Person> personList = new ArrayList<>();\n personList.add(person1);\n personList.add(person2);\n\n final ObjectSerializer serializer = new MyJsonSerializer(); // Replace this with your Serializer\n BinaryData binaryData = BinaryData.fromObject(personList, serializer);\n\n // Retains the type of the list when deserializing\n List<Person> persons = binaryData.toObject(new TypeReference<List<Person>>() { }, serializer);\n persons.forEach(person -> System.out.println(\"Name : \" + person.getName()));\n```\n\n\n[Jackson JSON serializer]: https://mvnrepository.com/artifact/com.azure/azure-core-serializer-json-jackson\n[GSON JSON serializer]: https://mvnrepository.com/artifact/com.azure/azure-core-serializer-json-gson"
|
|
returns:
|
|
description: "An <xref uid=\"java.lang.Object\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Object\"></xref> representing the deserialized <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref>."
|
|
type: "<xref href=\"T?alt=T&text=T\" data-throw-if-not-resolved=\"False\" />"
|
|
- uid: "com.azure.core.util.BinaryData.<T>toObject(java.lang.Class<T>)"
|
|
fullName: "com.azure.core.util.BinaryData.toObject(Class<T> clazz)"
|
|
name: "toObject(Class<T> clazz)"
|
|
nameWithType: "BinaryData.toObject(Class<T> clazz)"
|
|
summary: "Returns an <xref uid=\"java.lang.Object\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Object\"></xref> representation of this <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> by deserializing its data using the default <xref uid=\"com.azure.core.util.serializer.JsonSerializer\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonSerializer\"></xref>."
|
|
parameters:
|
|
- description: "The <xref uid=\"java.lang.Class\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Class\"></xref> representing the Object's type."
|
|
name: "clazz"
|
|
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html\">Class</a><<xref href=\"T?alt=T&text=T\" data-throw-if-not-resolved=\"False\" />>"
|
|
syntax: "public T <T>toObject(Class<T> clazz)"
|
|
desc: "Returns an <xref uid=\"java.lang.Object\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Object\"></xref> representation of this <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> by deserializing its data using the default <xref uid=\"com.azure.core.util.serializer.JsonSerializer\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonSerializer\"></xref>. Each time this method is called, the content is deserialized and a new instance of type `T` is returned. So, calling this method repeatedly to convert the underlying data source into the same type is not recommended.\n\nThe type, represented by <xref uid=\"java.lang.Class\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Class\"></xref>, should be a non-generic class, for generic classes use <xref uid=\"com.azure.core.util.BinaryData.<T>toObject(com.azure.core.util.serializer.TypeReference<T>)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#toObject(TypeReference)\"></xref>.\n\n**Note:** This method first looks for a <xref uid=\"com.azure.core.util.serializer.JsonSerializerProvider\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonSerializerProvider\"></xref> implementation on the classpath. If no implementation is found, a default Jackson-based implementation will be used to deserialize the object.\n\n**Get a non-generic Object from the BinaryData**\n\n```java\nfinal Person data = new Person().setName(\"John\");\n\n // Ensure your classpath have the Serializer to serialize the object which implement implement\n // com.azure.core.util.serializer.JsonSerializer interface.\n // Or use Azure provided libraries for this.\n // https://central.sonatype.com/artifact/com.azure/azure-core-serializer-json-jackson or\n // https://central.sonatype.com/artifact/com.azure/azure-core-serializer-json-gson\n\n BinaryData binaryData = BinaryData.fromObject(data);\n\n Person person = binaryData.toObject(Person.class);\n System.out.println(person.getName());\n```"
|
|
returns:
|
|
description: "An <xref uid=\"java.lang.Object\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Object\"></xref> representing the JSON deserialized <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref>."
|
|
type: "<xref href=\"T?alt=T&text=T\" data-throw-if-not-resolved=\"False\" />"
|
|
- uid: "com.azure.core.util.BinaryData.<T>toObject(java.lang.Class<T>,com.azure.core.util.serializer.ObjectSerializer)"
|
|
fullName: "com.azure.core.util.BinaryData.toObject(Class<T> clazz, ObjectSerializer serializer)"
|
|
name: "toObject(Class<T> clazz, ObjectSerializer serializer)"
|
|
nameWithType: "BinaryData.toObject(Class<T> clazz, ObjectSerializer serializer)"
|
|
summary: "Returns an <xref uid=\"java.lang.Object\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Object\"></xref> representation of this <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> by deserializing its data using the passed <xref uid=\"com.azure.core.util.serializer.ObjectSerializer\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ObjectSerializer\"></xref>."
|
|
parameters:
|
|
- description: "The <xref uid=\"java.lang.Class\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Class\"></xref> representing the Object's type."
|
|
name: "clazz"
|
|
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html\">Class</a><<xref href=\"T?alt=T&text=T\" data-throw-if-not-resolved=\"False\" />>"
|
|
- description: "The <xref uid=\"com.azure.core.util.serializer.ObjectSerializer\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ObjectSerializer\"></xref> used to deserialize object."
|
|
name: "serializer"
|
|
type: "<xref href=\"com.azure.core.util.serializer.ObjectSerializer?alt=com.azure.core.util.serializer.ObjectSerializer&text=ObjectSerializer\" data-throw-if-not-resolved=\"False\" />"
|
|
syntax: "public T <T>toObject(Class<T> clazz, ObjectSerializer serializer)"
|
|
desc: "Returns an <xref uid=\"java.lang.Object\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Object\"></xref> representation of this <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> by deserializing its data using the passed <xref uid=\"com.azure.core.util.serializer.ObjectSerializer\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ObjectSerializer\"></xref>. Each time this method is called, the content is deserialized and a new instance of type `T` is returned. So, calling this method repeatedly to convert the underlying data source into the same type is not recommended.\n\nThe type, represented by <xref uid=\"java.lang.Class\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Class\"></xref>, should be a non-generic class, for generic classes use <xref uid=\"com.azure.core.util.BinaryData.<T>toObject(com.azure.core.util.serializer.TypeReference<T>,com.azure.core.util.serializer.ObjectSerializer)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#toObject(TypeReference, ObjectSerializer)\"></xref>.\n\nThe passed <xref uid=\"com.azure.core.util.serializer.ObjectSerializer\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ObjectSerializer\"></xref> can either be one of the implementations offered by the Azure SDKs or your own implementation.\n\n**Azure SDK implementations**\n\n * [Jackson JSON serializer][]\n * [GSON JSON serializer][]\n\n**Get a non-generic Object from the BinaryData**\n\n```java\nfinal Person data = new Person().setName(\"John\");\n\n // Provide your custom serializer or use Azure provided serializers.\n // https://central.sonatype.com/artifact/com.azure/azure-core-serializer-json-jackson or\n // https://central.sonatype.com/artifact/com.azure/azure-core-serializer-json-gson\n\n final ObjectSerializer serializer = new MyJsonSerializer(); // Replace this with your Serializer\n BinaryData binaryData = BinaryData.fromObject(data, serializer);\n\n Person person = binaryData.toObject(Person.class, serializer);\n System.out.println(\"Name : \" + person.getName());\n```\n\n\n[Jackson JSON serializer]: https://mvnrepository.com/artifact/com.azure/azure-core-serializer-json-jackson\n[GSON JSON serializer]: https://mvnrepository.com/artifact/com.azure/azure-core-serializer-json-gson"
|
|
returns:
|
|
description: "An <xref uid=\"java.lang.Object\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Object\"></xref> representing the deserialized <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref>."
|
|
type: "<xref href=\"T?alt=T&text=T\" data-throw-if-not-resolved=\"False\" />"
|
|
- uid: "com.azure.core.util.BinaryData.<T>toObjectAsync(com.azure.core.util.serializer.TypeReference<T>)"
|
|
fullName: "com.azure.core.util.BinaryData.toObjectAsync(TypeReference<T> typeReference)"
|
|
name: "toObjectAsync(TypeReference<T> typeReference)"
|
|
nameWithType: "BinaryData.toObjectAsync(TypeReference<T> typeReference)"
|
|
summary: "Returns an <xref uid=\"java.lang.Object\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Object\"></xref> representation of this <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> by deserializing its data using the default <xref uid=\"com.azure.core.util.serializer.JsonSerializer\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonSerializer\"></xref>."
|
|
parameters:
|
|
- description: "The <xref uid=\"com.azure.core.util.serializer.TypeReference\" data-throw-if-not-resolved=\"false\" data-raw-source=\"TypeReference\"></xref> representing the Object's type."
|
|
name: "typeReference"
|
|
type: "<xref href=\"com.azure.core.util.serializer.TypeReference?alt=com.azure.core.util.serializer.TypeReference&text=TypeReference\" data-throw-if-not-resolved=\"False\" /><<xref href=\"T?alt=T&text=T\" data-throw-if-not-resolved=\"False\" />>"
|
|
syntax: "public Mono<T> <T>toObjectAsync(TypeReference<T> typeReference)"
|
|
desc: "Returns an <xref uid=\"java.lang.Object\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Object\"></xref> representation of this <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> by deserializing its data using the default <xref uid=\"com.azure.core.util.serializer.JsonSerializer\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonSerializer\"></xref>. Each time this method is called, the content is deserialized and a new instance of type `T` is returned. So, calling this method repeatedly to convert the underlying data source into the same type is not recommended.\n\nThe type, represented by <xref uid=\"com.azure.core.util.serializer.TypeReference\" data-throw-if-not-resolved=\"false\" data-raw-source=\"TypeReference\"></xref>, can either be a generic or non-generic type. If the type is generic create a sub-type of <xref uid=\"com.azure.core.util.serializer.TypeReference\" data-throw-if-not-resolved=\"false\" data-raw-source=\"TypeReference\"></xref>, if the type is non-generic use <xref uid=\"com.azure.core.util.serializer.TypeReference.<T>createInstance(java.lang.Class<T>)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"TypeReference#createInstance(Class)\"></xref>.\n\n**Note:** This method first looks for a <xref uid=\"com.azure.core.util.serializer.JsonSerializerProvider\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonSerializerProvider\"></xref> implementation on the classpath. If no implementation is found, a default Jackson-based implementation will be used to deserialize the object.\n\n**Get a non-generic Object from the BinaryData**\n\n```java\nfinal Person data = new Person().setName(\"John\");\n\n // Ensure your classpath have the Serializer to serialize the object which implement implement\n // com.azure.core.util.serializer.JsonSerializer interface.\n // Or use Azure provided libraries for this.\n // https://central.sonatype.com/artifact/com.azure/azure-core-serializer-json-jackson or\n // https://central.sonatype.com/artifact/com.azure/azure-core-serializer-json-gson\n\n BinaryData binaryData = BinaryData.fromObject(data);\n\n Disposable subscriber = binaryData.toObjectAsync(TypeReference.createInstance(Person.class))\n .subscribe(person -> System.out.println(person.getName()));\n\n // So that your program wait for above subscribe to complete.\n TimeUnit.SECONDS.sleep(5);\n subscriber.dispose();\n```\n\n**Get a generic Object from the BinaryData**\n\n```java\nfinal Person person1 = new Person().setName(\"John\");\n final Person person2 = new Person().setName(\"Jack\");\n\n List<Person> personList = new ArrayList<>();\n personList.add(person1);\n personList.add(person2);\n\n BinaryData binaryData = BinaryData.fromObject(personList);\n\n Disposable subscriber = binaryData.toObjectAsync(new TypeReference<List<Person>>() { })\n .subscribe(persons -> persons.forEach(person -> System.out.println(person.getName())));\n\n // So that your program wait for above subscribe to complete.\n TimeUnit.SECONDS.sleep(5);\n subscriber.dispose();\n```"
|
|
returns:
|
|
description: "A <xref uid=\"reactor.core.publisher.Mono\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Mono\"></xref> of <xref uid=\"java.lang.Object\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Object\"></xref> representing the JSON deserialized <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref>."
|
|
type: "<a href=\"https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Mono.html\">Mono</a><<xref href=\"T?alt=T&text=T\" data-throw-if-not-resolved=\"False\" />>"
|
|
- uid: "com.azure.core.util.BinaryData.<T>toObjectAsync(com.azure.core.util.serializer.TypeReference<T>,com.azure.core.util.serializer.ObjectSerializer)"
|
|
fullName: "com.azure.core.util.BinaryData.toObjectAsync(TypeReference<T> typeReference, ObjectSerializer serializer)"
|
|
name: "toObjectAsync(TypeReference<T> typeReference, ObjectSerializer serializer)"
|
|
nameWithType: "BinaryData.toObjectAsync(TypeReference<T> typeReference, ObjectSerializer serializer)"
|
|
summary: "Returns an <xref uid=\"java.lang.Object\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Object\"></xref> representation of this <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> by deserializing its data using the passed <xref uid=\"com.azure.core.util.serializer.ObjectSerializer\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ObjectSerializer\"></xref>."
|
|
parameters:
|
|
- description: "The <xref uid=\"com.azure.core.util.serializer.TypeReference\" data-throw-if-not-resolved=\"false\" data-raw-source=\"TypeReference\"></xref> representing the Object's type."
|
|
name: "typeReference"
|
|
type: "<xref href=\"com.azure.core.util.serializer.TypeReference?alt=com.azure.core.util.serializer.TypeReference&text=TypeReference\" data-throw-if-not-resolved=\"False\" /><<xref href=\"T?alt=T&text=T\" data-throw-if-not-resolved=\"False\" />>"
|
|
- description: "The <xref uid=\"com.azure.core.util.serializer.ObjectSerializer\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ObjectSerializer\"></xref> used to deserialize object."
|
|
name: "serializer"
|
|
type: "<xref href=\"com.azure.core.util.serializer.ObjectSerializer?alt=com.azure.core.util.serializer.ObjectSerializer&text=ObjectSerializer\" data-throw-if-not-resolved=\"False\" />"
|
|
syntax: "public Mono<T> <T>toObjectAsync(TypeReference<T> typeReference, ObjectSerializer serializer)"
|
|
desc: "Returns an <xref uid=\"java.lang.Object\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Object\"></xref> representation of this <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> by deserializing its data using the passed <xref uid=\"com.azure.core.util.serializer.ObjectSerializer\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ObjectSerializer\"></xref>. Each time this method is called, the content is deserialized and a new instance of type `T` is returned. So, calling this method repeatedly to convert the underlying data source into the same type is not recommended.\n\nThe type, represented by <xref uid=\"com.azure.core.util.serializer.TypeReference\" data-throw-if-not-resolved=\"false\" data-raw-source=\"TypeReference\"></xref>, can either be a generic or non-generic type. If the type is generic create a sub-type of <xref uid=\"com.azure.core.util.serializer.TypeReference\" data-throw-if-not-resolved=\"false\" data-raw-source=\"TypeReference\"></xref>, if the type is non-generic use <xref uid=\"com.azure.core.util.serializer.TypeReference.<T>createInstance(java.lang.Class<T>)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"TypeReference#createInstance(Class)\"></xref>.\n\nThe passed <xref uid=\"com.azure.core.util.serializer.ObjectSerializer\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ObjectSerializer\"></xref> can either be one of the implementations offered by the Azure SDKs or your own implementation.\n\n**Azure SDK implementations**\n\n * [Jackson JSON serializer][]\n * [GSON JSON serializer][]\n\n**Get a non-generic Object from the BinaryData**\n\n```java\nfinal Person data = new Person().setName(\"John\");\n\n // Provide your custom serializer or use Azure provided serializers.\n // https://central.sonatype.com/artifact/com.azure/azure-core-serializer-json-jackson or\n // https://central.sonatype.com/artifact/com.azure/azure-core-serializer-json-gson\n\n final ObjectSerializer serializer = new MyJsonSerializer(); // Replace this with your Serializer\n BinaryData binaryData = BinaryData.fromObject(data, serializer);\n\n Disposable subscriber = binaryData\n .toObjectAsync(TypeReference.createInstance(Person.class), serializer)\n .subscribe(person -> System.out.println(person.getName()));\n\n // So that your program wait for above subscribe to complete.\n TimeUnit.SECONDS.sleep(5);\n subscriber.dispose();\n```\n\n**Get a generic Object from the BinaryData**\n\n```java\nfinal Person person1 = new Person().setName(\"John\");\n final Person person2 = new Person().setName(\"Jack\");\n\n List<Person> personList = new ArrayList<>();\n personList.add(person1);\n personList.add(person2);\n\n // Provide your custom serializer or use Azure provided serializers.\n // https://mvnrepository.com/artifact/com.azure/azure-core-serializer-json-jackson or\n // https://mvnrepository.com/artifact/com.azure/azure-core-serializer-json-gson\n\n final ObjectSerializer serializer = new MyJsonSerializer(); // Replace this with your Serializer\n BinaryData binaryData = BinaryData.fromObject(personList, serializer);\n\n Disposable subscriber = binaryData\n .toObjectAsync(new TypeReference<List<Person>>() { }, serializer) // retains the generic type information\n .subscribe(persons -> persons.forEach(person -> System.out.println(person.getName())));\n\n // So that your program wait for above subscribe to complete.\n TimeUnit.SECONDS.sleep(5);\n subscriber.dispose();\n```\n\n\n[Jackson JSON serializer]: https://mvnrepository.com/artifact/com.azure/azure-core-serializer-json-jackson\n[GSON JSON serializer]: https://mvnrepository.com/artifact/com.azure/azure-core-serializer-json-gson"
|
|
returns:
|
|
description: "A <xref uid=\"reactor.core.publisher.Mono\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Mono\"></xref> of <xref uid=\"java.lang.Object\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Object\"></xref> representing the deserialized <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref>."
|
|
type: "<a href=\"https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Mono.html\">Mono</a><<xref href=\"T?alt=T&text=T\" data-throw-if-not-resolved=\"False\" />>"
|
|
- uid: "com.azure.core.util.BinaryData.<T>toObjectAsync(java.lang.Class<T>)"
|
|
fullName: "com.azure.core.util.BinaryData.toObjectAsync(Class<T> clazz)"
|
|
name: "toObjectAsync(Class<T> clazz)"
|
|
nameWithType: "BinaryData.toObjectAsync(Class<T> clazz)"
|
|
summary: "Returns an <xref uid=\"java.lang.Object\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Object\"></xref> representation of this <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> by deserializing its data using the default <xref uid=\"com.azure.core.util.serializer.JsonSerializer\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonSerializer\"></xref>."
|
|
parameters:
|
|
- description: "The <xref uid=\"java.lang.Class\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Class\"></xref> representing the Object's type."
|
|
name: "clazz"
|
|
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html\">Class</a><<xref href=\"T?alt=T&text=T\" data-throw-if-not-resolved=\"False\" />>"
|
|
syntax: "public Mono<T> <T>toObjectAsync(Class<T> clazz)"
|
|
desc: "Returns an <xref uid=\"java.lang.Object\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Object\"></xref> representation of this <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> by deserializing its data using the default <xref uid=\"com.azure.core.util.serializer.JsonSerializer\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonSerializer\"></xref>. Each time this method is called, the content is deserialized and a new instance of type `T` is returned. So, calling this method repeatedly to convert the underlying data source into the same type is not recommended.\n\nThe type, represented by <xref uid=\"java.lang.Class\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Class\"></xref>, should be a non-generic class, for generic classes use <xref uid=\"com.azure.core.util.BinaryData.<T>toObject(com.azure.core.util.serializer.TypeReference<T>)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#toObject(TypeReference)\"></xref>.\n\n**Note:** This method first looks for a <xref uid=\"com.azure.core.util.serializer.JsonSerializerProvider\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonSerializerProvider\"></xref> implementation on the classpath. If no implementation is found, a default Jackson-based implementation will be used to deserialize the object.\n\n**Get a non-generic Object from the BinaryData**\n\n```java\nfinal Person data = new Person().setName(\"John\");\n\n // Ensure your classpath have the Serializer to serialize the object which implement implement\n // com.azure.core.util.serializer.JsonSerializer interface.\n // Or use Azure provided libraries for this.\n // https://central.sonatype.com/artifact/com.azure/azure-core-serializer-json-jackson or\n // https://central.sonatype.com/artifact/com.azure/azure-core-serializer-json-gson\n\n BinaryData binaryData = BinaryData.fromObject(data);\n\n Disposable subscriber = binaryData.toObjectAsync(Person.class)\n .subscribe(person -> System.out.println(person.getName()));\n\n // So that your program wait for above subscribe to complete.\n TimeUnit.SECONDS.sleep(5);\n subscriber.dispose();\n```"
|
|
returns:
|
|
description: "A <xref uid=\"reactor.core.publisher.Mono\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Mono\"></xref> of <xref uid=\"java.lang.Object\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Object\"></xref> representing the JSON deserialized <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref>."
|
|
type: "<a href=\"https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Mono.html\">Mono</a><<xref href=\"T?alt=T&text=T\" data-throw-if-not-resolved=\"False\" />>"
|
|
- uid: "com.azure.core.util.BinaryData.<T>toObjectAsync(java.lang.Class<T>,com.azure.core.util.serializer.ObjectSerializer)"
|
|
fullName: "com.azure.core.util.BinaryData.toObjectAsync(Class<T> clazz, ObjectSerializer serializer)"
|
|
name: "toObjectAsync(Class<T> clazz, ObjectSerializer serializer)"
|
|
nameWithType: "BinaryData.toObjectAsync(Class<T> clazz, ObjectSerializer serializer)"
|
|
summary: "Returns an <xref uid=\"java.lang.Object\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Object\"></xref> representation of this <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> by deserializing its data using the passed <xref uid=\"com.azure.core.util.serializer.ObjectSerializer\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ObjectSerializer\"></xref>."
|
|
parameters:
|
|
- description: "The <xref uid=\"java.lang.Class\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Class\"></xref> representing the Object's type."
|
|
name: "clazz"
|
|
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html\">Class</a><<xref href=\"T?alt=T&text=T\" data-throw-if-not-resolved=\"False\" />>"
|
|
- description: "The <xref uid=\"com.azure.core.util.serializer.ObjectSerializer\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ObjectSerializer\"></xref> used to deserialize object."
|
|
name: "serializer"
|
|
type: "<xref href=\"com.azure.core.util.serializer.ObjectSerializer?alt=com.azure.core.util.serializer.ObjectSerializer&text=ObjectSerializer\" data-throw-if-not-resolved=\"False\" />"
|
|
syntax: "public Mono<T> <T>toObjectAsync(Class<T> clazz, ObjectSerializer serializer)"
|
|
desc: "Returns an <xref uid=\"java.lang.Object\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Object\"></xref> representation of this <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> by deserializing its data using the passed <xref uid=\"com.azure.core.util.serializer.ObjectSerializer\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ObjectSerializer\"></xref>. Each time this method is called, the content is deserialized and a new instance of type `T` is returned. So, calling this method repeatedly to convert the underlying data source into the same type is not recommended.\n\nThe type, represented by <xref uid=\"java.lang.Class\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Class\"></xref>, should be a non-generic class, for generic classes use <xref uid=\"com.azure.core.util.BinaryData.<T>toObject(com.azure.core.util.serializer.TypeReference<T>,com.azure.core.util.serializer.ObjectSerializer)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#toObject(TypeReference, ObjectSerializer)\"></xref>.\n\nThe passed <xref uid=\"com.azure.core.util.serializer.ObjectSerializer\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ObjectSerializer\"></xref> can either be one of the implementations offered by the Azure SDKs or your own implementation.\n\n**Azure SDK implementations**\n\n * [Jackson JSON serializer][]\n * [GSON JSON serializer][]\n\n**Get a non-generic Object from the BinaryData**\n\n```java\nfinal Person data = new Person().setName(\"John\");\n\n // Provide your custom serializer or use Azure provided serializers.\n // https://central.sonatype.com/artifact/com.azure/azure-core-serializer-json-jackson or\n // https://central.sonatype.com/artifact/com.azure/azure-core-serializer-json-gson\n\n final ObjectSerializer serializer = new MyJsonSerializer(); // Replace this with your Serializer\n BinaryData binaryData = BinaryData.fromObject(data, serializer);\n\n Disposable subscriber = binaryData.toObjectAsync(Person.class, serializer)\n .subscribe(person -> System.out.println(person.getName()));\n\n // So that your program wait for above subscribe to complete.\n TimeUnit.SECONDS.sleep(5);\n subscriber.dispose();\n```\n\n\n[Jackson JSON serializer]: https://mvnrepository.com/artifact/com.azure/azure-core-serializer-json-jackson\n[GSON JSON serializer]: https://mvnrepository.com/artifact/com.azure/azure-core-serializer-json-gson"
|
|
returns:
|
|
description: "A <xref uid=\"reactor.core.publisher.Mono\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Mono\"></xref> of <xref uid=\"java.lang.Object\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Object\"></xref> representing the deserialized <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref>."
|
|
type: "<a href=\"https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Mono.html\">Mono</a><<xref href=\"T?alt=T&text=T\" data-throw-if-not-resolved=\"False\" />>"
|
|
- uid: "com.azure.core.util.BinaryData.fromByteBuffer(java.nio.ByteBuffer)"
|
|
fullName: "com.azure.core.util.BinaryData.fromByteBuffer(ByteBuffer data)"
|
|
name: "fromByteBuffer(ByteBuffer data)"
|
|
nameWithType: "BinaryData.fromByteBuffer(ByteBuffer data)"
|
|
summary: "Creates an instance of <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> from the given <xref uid=\"java.nio.ByteBuffer\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ByteBuffer\"></xref>."
|
|
modifiers:
|
|
- "static"
|
|
parameters:
|
|
- description: "The <xref uid=\"java.nio.ByteBuffer\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ByteBuffer\"></xref> that <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> will represent."
|
|
name: "data"
|
|
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/nio/ByteBuffer.html\">ByteBuffer</a>"
|
|
syntax: "public static BinaryData fromByteBuffer(ByteBuffer data)"
|
|
desc: "Creates an instance of <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> from the given <xref uid=\"java.nio.ByteBuffer\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ByteBuffer\"></xref>.\n\nIf the <xref uid=\"java.nio.ByteBuffer\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ByteBuffer\"></xref> is zero length an empty <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> will be returned. Note that the input <xref uid=\"java.nio.ByteBuffer\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ByteBuffer\"></xref> is used as a reference by this instance of <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> and any changes to the <xref uid=\"java.nio.ByteBuffer\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ByteBuffer\"></xref> outside of this instance will result in the contents of this BinaryData instance being updated as well. To safely update the <xref uid=\"java.nio.ByteBuffer\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ByteBuffer\"></xref> without impacting the BinaryData instance, perform an array copy first.\n\n**Create an instance from a ByteBuffer**\n\n```java\nfinal ByteBuffer data = ByteBuffer.wrap(\"Some Data\".getBytes(StandardCharsets.UTF_8));\n BinaryData binaryData = BinaryData.fromByteBuffer(data);\n System.out.println(binaryData);\n```"
|
|
returns:
|
|
description: "A <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> representing the <xref uid=\"java.nio.ByteBuffer\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ByteBuffer\"></xref>."
|
|
type: "<xref href=\"com.azure.core.util.BinaryData?alt=com.azure.core.util.BinaryData&text=BinaryData\" data-throw-if-not-resolved=\"False\" />"
|
|
- uid: "com.azure.core.util.BinaryData.fromBytes(byte[])"
|
|
fullName: "com.azure.core.util.BinaryData.fromBytes(byte[] data)"
|
|
name: "fromBytes(byte[] data)"
|
|
nameWithType: "BinaryData.fromBytes(byte[] data)"
|
|
summary: "Creates an instance of <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> from the given byte array."
|
|
modifiers:
|
|
- "static"
|
|
parameters:
|
|
- description: "The byte array that <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> will represent."
|
|
name: "data"
|
|
type: "<xref href=\"byte?alt=byte&text=byte\" data-throw-if-not-resolved=\"False\" />[]"
|
|
syntax: "public static BinaryData fromBytes(byte[] data)"
|
|
desc: "Creates an instance of <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> from the given byte array.\n\nIf the byte array is zero length an empty <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> will be returned. Note that the input byte array is used as a reference by this instance of <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> and any changes to the byte array outside of this instance will result in the contents of this BinaryData instance being updated as well. To safely update the byte array without impacting the BinaryData instance, perform an array copy first.\n\n**Create an instance from a byte array**\n\n```java\nfinal byte[] data = \"Some Data\".getBytes(StandardCharsets.UTF_8);\n BinaryData binaryData = BinaryData.fromBytes(data);\n System.out.println(new String(binaryData.toBytes(), StandardCharsets.UTF_8));\n```"
|
|
returns:
|
|
description: "A <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> representing the byte array."
|
|
type: "<xref href=\"com.azure.core.util.BinaryData?alt=com.azure.core.util.BinaryData&text=BinaryData\" data-throw-if-not-resolved=\"False\" />"
|
|
- uid: "com.azure.core.util.BinaryData.fromFile(java.nio.file.Path)"
|
|
fullName: "com.azure.core.util.BinaryData.fromFile(Path file)"
|
|
name: "fromFile(Path file)"
|
|
nameWithType: "BinaryData.fromFile(Path file)"
|
|
summary: "Creates a <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> that uses the content of the file at <xref uid=\"java.nio.file.Path\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Path\"></xref> as its data."
|
|
modifiers:
|
|
- "static"
|
|
parameters:
|
|
- description: "The <xref uid=\"java.nio.file.Path\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Path\"></xref> that will be the <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> data."
|
|
name: "file"
|
|
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/nio/file/Path.html\">Path</a>"
|
|
syntax: "public static BinaryData fromFile(Path file)"
|
|
desc: "Creates a <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> that uses the content of the file at <xref uid=\"java.nio.file.Path\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Path\"></xref> as its data. This method checks for the existence of the file at the time of creating an instance of <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref>. The file, however, is not read until there is an attempt to read the contents of the returned BinaryData instance.\n\n**Create an instance from a file**\n\nThe <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> returned from this method uses 8KB chunk size when reading file content.\n\n```java\nBinaryData binaryData = BinaryData.fromFile(new File(\"path/to/file\").toPath());\n System.out.println(new String(binaryData.toBytes(), StandardCharsets.UTF_8));\n```"
|
|
returns:
|
|
description: "A new <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref>."
|
|
type: "<xref href=\"com.azure.core.util.BinaryData?alt=com.azure.core.util.BinaryData&text=BinaryData\" data-throw-if-not-resolved=\"False\" />"
|
|
- uid: "com.azure.core.util.BinaryData.fromFile(java.nio.file.Path,int)"
|
|
fullName: "com.azure.core.util.BinaryData.fromFile(Path file, int chunkSize)"
|
|
name: "fromFile(Path file, int chunkSize)"
|
|
nameWithType: "BinaryData.fromFile(Path file, int chunkSize)"
|
|
summary: "Creates a <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> that uses the content of the file at <xref uid=\"java.nio.file.Path\" data-throw-if-not-resolved=\"false\" data-raw-source=\"file\"></xref> as its data."
|
|
modifiers:
|
|
- "static"
|
|
parameters:
|
|
- description: "The <xref uid=\"java.nio.file.Path\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Path\"></xref> that will be the <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> data."
|
|
name: "file"
|
|
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/nio/file/Path.html\">Path</a>"
|
|
- description: "The requested size for each read of the path."
|
|
name: "chunkSize"
|
|
type: "<xref href=\"int?alt=int&text=int\" data-throw-if-not-resolved=\"False\" />"
|
|
syntax: "public static BinaryData fromFile(Path file, int chunkSize)"
|
|
desc: "Creates a <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> that uses the content of the file at <xref uid=\"java.nio.file.Path\" data-throw-if-not-resolved=\"false\" data-raw-source=\"file\"></xref> as its data. This method checks for the existence of the file at the time of creating an instance of <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref>. The file, however, is not read until there is an attempt to read the contents of the returned BinaryData instance.\n\n**Create an instance from a file**\n\n```java\nBinaryData binaryData = BinaryData.fromFile(new File(\"path/to/file\").toPath(), 8092);\n System.out.println(new String(binaryData.toBytes(), StandardCharsets.UTF_8));\n```"
|
|
returns:
|
|
description: "A new <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref>."
|
|
type: "<xref href=\"com.azure.core.util.BinaryData?alt=com.azure.core.util.BinaryData&text=BinaryData\" data-throw-if-not-resolved=\"False\" />"
|
|
- uid: "com.azure.core.util.BinaryData.fromFile(java.nio.file.Path,java.lang.Long,java.lang.Long)"
|
|
fullName: "com.azure.core.util.BinaryData.fromFile(Path file, Long position, Long length)"
|
|
name: "fromFile(Path file, Long position, Long length)"
|
|
nameWithType: "BinaryData.fromFile(Path file, Long position, Long length)"
|
|
summary: "Creates a <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> that uses the content of the file at <xref uid=\"java.nio.file.Path\" data-throw-if-not-resolved=\"false\" data-raw-source=\"file\"></xref> as its data."
|
|
modifiers:
|
|
- "static"
|
|
parameters:
|
|
- description: "The <xref uid=\"java.nio.file.Path\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Path\"></xref> that will be the <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> data."
|
|
name: "file"
|
|
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/nio/file/Path.html\">Path</a>"
|
|
- description: "Position, or offset, within the path where reading begins."
|
|
name: "position"
|
|
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Long.html\">Long</a>"
|
|
- description: "Maximum number of bytes to be read from the path."
|
|
name: "length"
|
|
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Long.html\">Long</a>"
|
|
syntax: "public static BinaryData fromFile(Path file, Long position, Long length)"
|
|
desc: "Creates a <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> that uses the content of the file at <xref uid=\"java.nio.file.Path\" data-throw-if-not-resolved=\"false\" data-raw-source=\"file\"></xref> as its data. This method checks for the existence of the file at the time of creating an instance of <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref>. The file, however, is not read until there is an attempt to read the contents of the returned BinaryData instance.\n\n**Create an instance from a file**\n\nThe <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> returned from this method uses 8KB chunk size when reading file content.\n\n```java\nlong position = 1024;\n long length = 100 * 1048;\n BinaryData binaryData = BinaryData.fromFile(\n new File(\"path/to/file\").toPath(), position, length);\n System.out.println(new String(binaryData.toBytes(), StandardCharsets.UTF_8));\n```"
|
|
returns:
|
|
description: "A new <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref>."
|
|
type: "<xref href=\"com.azure.core.util.BinaryData?alt=com.azure.core.util.BinaryData&text=BinaryData\" data-throw-if-not-resolved=\"False\" />"
|
|
- uid: "com.azure.core.util.BinaryData.fromFile(java.nio.file.Path,java.lang.Long,java.lang.Long,int)"
|
|
fullName: "com.azure.core.util.BinaryData.fromFile(Path file, Long position, Long length, int chunkSize)"
|
|
name: "fromFile(Path file, Long position, Long length, int chunkSize)"
|
|
nameWithType: "BinaryData.fromFile(Path file, Long position, Long length, int chunkSize)"
|
|
summary: "Creates a <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> that uses the content of the file at <xref uid=\"java.nio.file.Path\" data-throw-if-not-resolved=\"false\" data-raw-source=\"file\"></xref> as its data."
|
|
modifiers:
|
|
- "static"
|
|
parameters:
|
|
- description: "The <xref uid=\"java.nio.file.Path\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Path\"></xref> that will be the <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> data."
|
|
name: "file"
|
|
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/nio/file/Path.html\">Path</a>"
|
|
- description: "Position, or offset, within the path where reading begins."
|
|
name: "position"
|
|
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Long.html\">Long</a>"
|
|
- description: "Maximum number of bytes to be read from the path."
|
|
name: "length"
|
|
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Long.html\">Long</a>"
|
|
- description: "The requested size for each read of the path."
|
|
name: "chunkSize"
|
|
type: "<xref href=\"int?alt=int&text=int\" data-throw-if-not-resolved=\"False\" />"
|
|
syntax: "public static BinaryData fromFile(Path file, Long position, Long length, int chunkSize)"
|
|
desc: "Creates a <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> that uses the content of the file at <xref uid=\"java.nio.file.Path\" data-throw-if-not-resolved=\"false\" data-raw-source=\"file\"></xref> as its data. This method checks for the existence of the file at the time of creating an instance of <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref>. The file, however, is not read until there is an attempt to read the contents of the returned BinaryData instance.\n\n**Create an instance from a file**\n\n```java\nlong position = 1024;\n long length = 100 * 1048;\n int chunkSize = 8092;\n BinaryData binaryData = BinaryData.fromFile(\n new File(\"path/to/file\").toPath(), position, length, chunkSize);\n System.out.println(new String(binaryData.toBytes(), StandardCharsets.UTF_8));\n```"
|
|
returns:
|
|
description: "A new <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref>."
|
|
type: "<xref href=\"com.azure.core.util.BinaryData?alt=com.azure.core.util.BinaryData&text=BinaryData\" data-throw-if-not-resolved=\"False\" />"
|
|
- uid: "com.azure.core.util.BinaryData.fromFlux(reactor.core.publisher.Flux<java.nio.ByteBuffer>)"
|
|
fullName: "com.azure.core.util.BinaryData.fromFlux(Flux<ByteBuffer> data)"
|
|
name: "fromFlux(Flux<ByteBuffer> data)"
|
|
nameWithType: "BinaryData.fromFlux(Flux<ByteBuffer> data)"
|
|
summary: "Creates an instance of <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> from the given <xref uid=\"reactor.core.publisher.Flux\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Flux\"></xref> of <xref uid=\"java.nio.ByteBuffer\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ByteBuffer\"></xref>."
|
|
modifiers:
|
|
- "static"
|
|
parameters:
|
|
- description: "The <xref uid=\"reactor.core.publisher.Flux\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Flux\"></xref> of <xref uid=\"java.nio.ByteBuffer\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ByteBuffer\"></xref> that <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> will represent."
|
|
name: "data"
|
|
type: "<a href=\"https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Flux.html\">Flux</a><<a href=\"https://docs.oracle.com/javase/8/docs/api/java/nio/ByteBuffer.html\">ByteBuffer</a>>"
|
|
syntax: "public static Mono<BinaryData> fromFlux(Flux<ByteBuffer> data)"
|
|
desc: "Creates an instance of <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> from the given <xref uid=\"reactor.core.publisher.Flux\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Flux\"></xref> of <xref uid=\"java.nio.ByteBuffer\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ByteBuffer\"></xref>.\n\n**Create an instance from a Flux of ByteBuffer**\n\nThis method aggregates data into single byte array.\n\n```java\nfinal byte[] data = \"Some Data\".getBytes(StandardCharsets.UTF_8);\n final Flux<ByteBuffer> dataFlux = Flux.just(ByteBuffer.wrap(data));\n\n Mono<BinaryData> binaryDataMono = BinaryData.fromFlux(dataFlux);\n\n Disposable subscriber = binaryDataMono\n .map(binaryData -> {\n System.out.println(binaryData.toString());\n return true;\n })\n .subscribe();\n\n // So that your program wait for above subscribe to complete.\n TimeUnit.SECONDS.sleep(5);\n subscriber.dispose();\n```"
|
|
returns:
|
|
description: "A <xref uid=\"reactor.core.publisher.Mono\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Mono\"></xref> of <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> representing the <xref uid=\"reactor.core.publisher.Flux\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Flux\"></xref> of <xref uid=\"java.nio.ByteBuffer\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ByteBuffer\"></xref>."
|
|
type: "<a href=\"https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Mono.html\">Mono</a><<xref href=\"com.azure.core.util.BinaryData?alt=com.azure.core.util.BinaryData&text=BinaryData\" data-throw-if-not-resolved=\"False\" />>"
|
|
- uid: "com.azure.core.util.BinaryData.fromFlux(reactor.core.publisher.Flux<java.nio.ByteBuffer>,java.lang.Long)"
|
|
fullName: "com.azure.core.util.BinaryData.fromFlux(Flux<ByteBuffer> data, Long length)"
|
|
name: "fromFlux(Flux<ByteBuffer> data, Long length)"
|
|
nameWithType: "BinaryData.fromFlux(Flux<ByteBuffer> data, Long length)"
|
|
summary: "Creates an instance of <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> from the given <xref uid=\"reactor.core.publisher.Flux\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Flux\"></xref> of <xref uid=\"java.nio.ByteBuffer\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ByteBuffer\"></xref>."
|
|
modifiers:
|
|
- "static"
|
|
parameters:
|
|
- description: "The <xref uid=\"reactor.core.publisher.Flux\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Flux\"></xref> of <xref uid=\"java.nio.ByteBuffer\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ByteBuffer\"></xref> that <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> will represent."
|
|
name: "data"
|
|
type: "<a href=\"https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Flux.html\">Flux</a><<a href=\"https://docs.oracle.com/javase/8/docs/api/java/nio/ByteBuffer.html\">ByteBuffer</a>>"
|
|
- description: "The length of <code>data</code> in bytes."
|
|
name: "length"
|
|
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Long.html\">Long</a>"
|
|
syntax: "public static Mono<BinaryData> fromFlux(Flux<ByteBuffer> data, Long length)"
|
|
desc: "Creates an instance of <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> from the given <xref uid=\"reactor.core.publisher.Flux\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Flux\"></xref> of <xref uid=\"java.nio.ByteBuffer\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ByteBuffer\"></xref>.\n\n**Create an instance from a Flux of ByteBuffer**\n\nThis method aggregates data into single byte array.\n\n```java\nfinal byte[] data = \"Some Data\".getBytes(StandardCharsets.UTF_8);\n final long length = data.length;\n final Flux<ByteBuffer> dataFlux = Flux.just(ByteBuffer.wrap(data));\n\n Mono<BinaryData> binaryDataMono = BinaryData.fromFlux(dataFlux, length);\n\n Disposable subscriber = binaryDataMono\n .map(binaryData -> {\n System.out.println(binaryData.toString());\n return true;\n })\n .subscribe();\n\n // So that your program wait for above subscribe to complete.\n TimeUnit.SECONDS.sleep(5);\n subscriber.dispose();\n```"
|
|
returns:
|
|
description: "A <xref uid=\"reactor.core.publisher.Mono\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Mono\"></xref> of <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> representing the <xref uid=\"reactor.core.publisher.Flux\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Flux\"></xref> of <xref uid=\"java.nio.ByteBuffer\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ByteBuffer\"></xref>."
|
|
type: "<a href=\"https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Mono.html\">Mono</a><<xref href=\"com.azure.core.util.BinaryData?alt=com.azure.core.util.BinaryData&text=BinaryData\" data-throw-if-not-resolved=\"False\" />>"
|
|
- uid: "com.azure.core.util.BinaryData.fromFlux(reactor.core.publisher.Flux<java.nio.ByteBuffer>,java.lang.Long,boolean)"
|
|
fullName: "com.azure.core.util.BinaryData.fromFlux(Flux<ByteBuffer> data, Long length, boolean bufferContent)"
|
|
name: "fromFlux(Flux<ByteBuffer> data, Long length, boolean bufferContent)"
|
|
nameWithType: "BinaryData.fromFlux(Flux<ByteBuffer> data, Long length, boolean bufferContent)"
|
|
summary: "Creates an instance of <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> from the given <xref uid=\"reactor.core.publisher.Flux\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Flux\"></xref> of <xref uid=\"java.nio.ByteBuffer\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ByteBuffer\"></xref>."
|
|
modifiers:
|
|
- "static"
|
|
parameters:
|
|
- description: "The <xref uid=\"reactor.core.publisher.Flux\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Flux\"></xref> of <xref uid=\"java.nio.ByteBuffer\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ByteBuffer\"></xref> that <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> will represent."
|
|
name: "data"
|
|
type: "<a href=\"https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Flux.html\">Flux</a><<a href=\"https://docs.oracle.com/javase/8/docs/api/java/nio/ByteBuffer.html\">ByteBuffer</a>>"
|
|
- description: "The length of <code>data</code> in bytes."
|
|
name: "length"
|
|
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Long.html\">Long</a>"
|
|
- description: "A flag indicating whether <xref uid=\"reactor.core.publisher.Flux\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Flux\"></xref> should be buffered eagerly or consumption deferred."
|
|
name: "bufferContent"
|
|
type: "<xref href=\"boolean?alt=boolean&text=boolean\" data-throw-if-not-resolved=\"False\" />"
|
|
syntax: "public static Mono<BinaryData> fromFlux(Flux<ByteBuffer> data, Long length, boolean bufferContent)"
|
|
desc: "Creates an instance of <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> from the given <xref uid=\"reactor.core.publisher.Flux\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Flux\"></xref> of <xref uid=\"java.nio.ByteBuffer\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ByteBuffer\"></xref>.\n\nIf `bufferContent` is true and `length` is null the length of the returned <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> will be based on the length calculated by buffering. If `length` is non-null it will always be used as the <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> length even if buffering determines a different length.\n\n**Create an instance from a Flux of ByteBuffer**\n\n```java\nfinal byte[] data = \"Some Data\".getBytes(StandardCharsets.UTF_8);\n final long length = data.length;\n final boolean shouldAggregateData = false;\n final Flux<ByteBuffer> dataFlux = Flux.just(ByteBuffer.wrap(data));\n\n Mono<BinaryData> binaryDataMono = BinaryData.fromFlux(dataFlux, length, shouldAggregateData);\n\n Disposable subscriber = binaryDataMono\n .map(binaryData -> {\n System.out.println(binaryData.toString());\n return true;\n })\n .subscribe();\n\n // So that your program wait for above subscribe to complete.\n TimeUnit.SECONDS.sleep(5);\n subscriber.dispose();\n```"
|
|
returns:
|
|
description: "A <xref uid=\"reactor.core.publisher.Mono\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Mono\"></xref> of <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> representing the <xref uid=\"reactor.core.publisher.Flux\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Flux\"></xref> of <xref uid=\"java.nio.ByteBuffer\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ByteBuffer\"></xref>."
|
|
type: "<a href=\"https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Mono.html\">Mono</a><<xref href=\"com.azure.core.util.BinaryData?alt=com.azure.core.util.BinaryData&text=BinaryData\" data-throw-if-not-resolved=\"False\" />>"
|
|
- uid: "com.azure.core.util.BinaryData.fromListByteBuffer(java.util.List<java.nio.ByteBuffer>)"
|
|
fullName: "com.azure.core.util.BinaryData.fromListByteBuffer(List<ByteBuffer> data)"
|
|
name: "fromListByteBuffer(List<ByteBuffer> data)"
|
|
nameWithType: "BinaryData.fromListByteBuffer(List<ByteBuffer> data)"
|
|
summary: "Creates an instance of <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> from the given <xref uid=\"java.util.List\" data-throw-if-not-resolved=\"false\" data-raw-source=\"List\"></xref> of <xref uid=\"java.nio.ByteBuffer\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ByteBuffer\"></xref>."
|
|
modifiers:
|
|
- "static"
|
|
parameters:
|
|
- description: "The <xref uid=\"java.util.List\" data-throw-if-not-resolved=\"false\" data-raw-source=\"List\"></xref> of <xref uid=\"java.nio.ByteBuffer\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ByteBuffer\"></xref> that <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> will represent."
|
|
name: "data"
|
|
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/util/List.html\">List</a><<a href=\"https://docs.oracle.com/javase/8/docs/api/java/nio/ByteBuffer.html\">ByteBuffer</a>>"
|
|
syntax: "public static BinaryData fromListByteBuffer(List<ByteBuffer> data)"
|
|
desc: "Creates an instance of <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> from the given <xref uid=\"java.util.List\" data-throw-if-not-resolved=\"false\" data-raw-source=\"List\"></xref> of <xref uid=\"java.nio.ByteBuffer\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ByteBuffer\"></xref>.\n\nThe input <xref uid=\"java.nio.ByteBuffer\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ByteBuffer\"></xref> instances are used as a reference by this instance of <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> and any changes to a <xref uid=\"java.nio.ByteBuffer\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ByteBuffer\"></xref> outside of this instance will result in the contents of this BinaryData instance being updated as well. To safely update the byte array without impacting the BinaryData instance, perform an array copy first.\n\n**Create an instance from a List<ByteBuffer>**\n\n```java\nfinal List<ByteBuffer> data = Stream.of(\"Some \", \"data\")\n .map(s -> ByteBuffer.wrap(s.getBytes(StandardCharsets.UTF_8)))\n .collect(Collectors.toList());\n BinaryData binaryData = BinaryData.fromListByteBuffer(data);\n System.out.println(binaryData);\n```"
|
|
returns:
|
|
description: "A <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> representing the <xref uid=\"java.util.List\" data-throw-if-not-resolved=\"false\" data-raw-source=\"List\"></xref> of <xref uid=\"java.nio.ByteBuffer\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ByteBuffer\"></xref>."
|
|
type: "<xref href=\"com.azure.core.util.BinaryData?alt=com.azure.core.util.BinaryData&text=BinaryData\" data-throw-if-not-resolved=\"False\" />"
|
|
- uid: "com.azure.core.util.BinaryData.fromObject(java.lang.Object)"
|
|
fullName: "com.azure.core.util.BinaryData.fromObject(Object data)"
|
|
name: "fromObject(Object data)"
|
|
nameWithType: "BinaryData.fromObject(Object data)"
|
|
summary: "Creates an instance of <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> by serializing the <xref uid=\"java.lang.Object\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Object\"></xref> using the default <xref uid=\"com.azure.core.util.serializer.JsonSerializer\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonSerializer\"></xref>."
|
|
modifiers:
|
|
- "static"
|
|
parameters:
|
|
- description: "The object that will be JSON serialized that <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> will represent."
|
|
name: "data"
|
|
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html\">Object</a>"
|
|
syntax: "public static BinaryData fromObject(Object data)"
|
|
desc: "Creates an instance of <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> by serializing the <xref uid=\"java.lang.Object\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Object\"></xref> using the default <xref uid=\"com.azure.core.util.serializer.JsonSerializer\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonSerializer\"></xref>.\n\n**Note:** This method first looks for a <xref uid=\"com.azure.core.util.serializer.JsonSerializerProvider\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonSerializerProvider\"></xref> implementation on the classpath. If no implementation is found, a default Jackson-based implementation will be used to serialize the object.\n\n**Creating an instance from an Object**\n\n```java\nfinal Person data = new Person().setName(\"John\");\n\n // Provide your custom serializer or use Azure provided serializers.\n // https://central.sonatype.com/artifact/com.azure/azure-core-serializer-json-jackson or\n // https://central.sonatype.com/artifact/com.azure/azure-core-serializer-json-gson\n BinaryData binaryData = BinaryData.fromObject(data);\n\n System.out.println(binaryData);\n```"
|
|
returns:
|
|
description: "A <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> representing the JSON serialized object."
|
|
type: "<xref href=\"com.azure.core.util.BinaryData?alt=com.azure.core.util.BinaryData&text=BinaryData\" data-throw-if-not-resolved=\"False\" />"
|
|
- uid: "com.azure.core.util.BinaryData.fromObject(java.lang.Object,com.azure.core.util.serializer.ObjectSerializer)"
|
|
fullName: "com.azure.core.util.BinaryData.fromObject(Object data, ObjectSerializer serializer)"
|
|
name: "fromObject(Object data, ObjectSerializer serializer)"
|
|
nameWithType: "BinaryData.fromObject(Object data, ObjectSerializer serializer)"
|
|
summary: "Creates an instance of <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> by serializing the <xref uid=\"java.lang.Object\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Object\"></xref> using the passed <xref uid=\"com.azure.core.util.serializer.ObjectSerializer\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ObjectSerializer\"></xref>."
|
|
modifiers:
|
|
- "static"
|
|
parameters:
|
|
- description: "The object that will be serialized that <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> will represent. The <code>serializer</code>\n determines how <code>null</code> data is serialized."
|
|
name: "data"
|
|
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html\">Object</a>"
|
|
- description: "The <xref uid=\"com.azure.core.util.serializer.ObjectSerializer\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ObjectSerializer\"></xref> used to serialize object."
|
|
name: "serializer"
|
|
type: "<xref href=\"com.azure.core.util.serializer.ObjectSerializer?alt=com.azure.core.util.serializer.ObjectSerializer&text=ObjectSerializer\" data-throw-if-not-resolved=\"False\" />"
|
|
syntax: "public static BinaryData fromObject(Object data, ObjectSerializer serializer)"
|
|
desc: "Creates an instance of <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> by serializing the <xref uid=\"java.lang.Object\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Object\"></xref> using the passed <xref uid=\"com.azure.core.util.serializer.ObjectSerializer\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ObjectSerializer\"></xref>.\n\nThe passed <xref uid=\"com.azure.core.util.serializer.ObjectSerializer\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ObjectSerializer\"></xref> can either be one of the implementations offered by the Azure SDKs or your own implementation.\n\n**Azure SDK implementations**\n\n * [Jackson JSON serializer][]\n * [GSON JSON serializer][]\n\n**Create an instance from an Object**\n\n```java\nfinal Person data = new Person().setName(\"John\");\n\n // Provide your custom serializer or use Azure provided serializers.\n // https://central.sonatype.com/artifact/com.azure/azure-core-serializer-json-jackson or\n // https://central.sonatype.com/artifact/com.azure/azure-core-serializer-json-gson\n final ObjectSerializer serializer = new MyJsonSerializer(); // Replace this with your Serializer\n BinaryData binaryData = BinaryData.fromObject(data, serializer);\n\n System.out.println(binaryData.toString());\n```\n\n\n[Jackson JSON serializer]: https://mvnrepository.com/artifact/com.azure/azure-core-serializer-json-jackson\n[GSON JSON serializer]: https://mvnrepository.com/artifact/com.azure/azure-core-serializer-json-gson"
|
|
returns:
|
|
description: "A <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> representing the serialized object."
|
|
type: "<xref href=\"com.azure.core.util.BinaryData?alt=com.azure.core.util.BinaryData&text=BinaryData\" data-throw-if-not-resolved=\"False\" />"
|
|
- uid: "com.azure.core.util.BinaryData.fromObjectAsync(java.lang.Object)"
|
|
fullName: "com.azure.core.util.BinaryData.fromObjectAsync(Object data)"
|
|
name: "fromObjectAsync(Object data)"
|
|
nameWithType: "BinaryData.fromObjectAsync(Object data)"
|
|
summary: "Creates an instance of <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> by serializing the <xref uid=\"java.lang.Object\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Object\"></xref> using the default <xref uid=\"com.azure.core.util.serializer.JsonSerializer\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonSerializer\"></xref>."
|
|
modifiers:
|
|
- "static"
|
|
parameters:
|
|
- description: "The object that will be JSON serialized that <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> will represent."
|
|
name: "data"
|
|
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html\">Object</a>"
|
|
syntax: "public static Mono<BinaryData> fromObjectAsync(Object data)"
|
|
desc: "Creates an instance of <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> by serializing the <xref uid=\"java.lang.Object\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Object\"></xref> using the default <xref uid=\"com.azure.core.util.serializer.JsonSerializer\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonSerializer\"></xref>.\n\n**Note:** This method first looks for a <xref uid=\"com.azure.core.util.serializer.JsonSerializerProvider\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonSerializerProvider\"></xref> implementation on the classpath. If no implementation is found, a default Jackson-based implementation will be used to serialize the object.\n\n**Creating an instance from an Object**\n\n```java\nfinal Person data = new Person().setName(\"John\");\n\n // Provide your custom serializer or use Azure provided serializers.\n // https://central.sonatype.com/artifact/com.azure/azure-core-serializer-json-jackson or\n // https://central.sonatype.com/artifact/com.azure/azure-core-serializer-json-gson\n Disposable subscriber = BinaryData.fromObjectAsync(data)\n .subscribe(binaryData -> System.out.println(binaryData.toString()));\n\n // So that your program wait for above subscribe to complete.\n TimeUnit.SECONDS.sleep(5);\n subscriber.dispose();\n```"
|
|
returns:
|
|
description: "A <xref uid=\"reactor.core.publisher.Mono\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Mono\"></xref> of <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> representing the JSON serialized object."
|
|
type: "<a href=\"https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Mono.html\">Mono</a><<xref href=\"com.azure.core.util.BinaryData?alt=com.azure.core.util.BinaryData&text=BinaryData\" data-throw-if-not-resolved=\"False\" />>"
|
|
- uid: "com.azure.core.util.BinaryData.fromObjectAsync(java.lang.Object,com.azure.core.util.serializer.ObjectSerializer)"
|
|
fullName: "com.azure.core.util.BinaryData.fromObjectAsync(Object data, ObjectSerializer serializer)"
|
|
name: "fromObjectAsync(Object data, ObjectSerializer serializer)"
|
|
nameWithType: "BinaryData.fromObjectAsync(Object data, ObjectSerializer serializer)"
|
|
summary: "Creates an instance of <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> by serializing the <xref uid=\"java.lang.Object\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Object\"></xref> using the passed <xref uid=\"com.azure.core.util.serializer.ObjectSerializer\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ObjectSerializer\"></xref>."
|
|
modifiers:
|
|
- "static"
|
|
parameters:
|
|
- description: "The object that will be serialized that <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> will represent. The <code>serializer</code>\n determines how <code>null</code> data is serialized."
|
|
name: "data"
|
|
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html\">Object</a>"
|
|
- description: "The <xref uid=\"com.azure.core.util.serializer.ObjectSerializer\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ObjectSerializer\"></xref> used to serialize object."
|
|
name: "serializer"
|
|
type: "<xref href=\"com.azure.core.util.serializer.ObjectSerializer?alt=com.azure.core.util.serializer.ObjectSerializer&text=ObjectSerializer\" data-throw-if-not-resolved=\"False\" />"
|
|
syntax: "public static Mono<BinaryData> fromObjectAsync(Object data, ObjectSerializer serializer)"
|
|
desc: "Creates an instance of <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> by serializing the <xref uid=\"java.lang.Object\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Object\"></xref> using the passed <xref uid=\"com.azure.core.util.serializer.ObjectSerializer\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ObjectSerializer\"></xref>.\n\nThe passed <xref uid=\"com.azure.core.util.serializer.ObjectSerializer\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ObjectSerializer\"></xref> can either be one of the implementations offered by the Azure SDKs or your own implementation.\n\n**Azure SDK implementations**\n\n * [Jackson JSON serializer][]\n * [GSON JSON serializer][]\n\n**Create an instance from an Object**\n\n```java\nfinal Person data = new Person().setName(\"John\");\n\n // Provide your custom serializer or use Azure provided serializers.\n // https://central.sonatype.com/artifact/com.azure/azure-core-serializer-json-jackson or\n // https://central.sonatype.com/artifact/com.azure/azure-core-serializer-json-gson\n final ObjectSerializer serializer = new MyJsonSerializer(); // Replace this with your Serializer\n Disposable subscriber = BinaryData.fromObjectAsync(data, serializer)\n .subscribe(binaryData -> System.out.println(binaryData.toString()));\n\n // So that your program wait for above subscribe to complete.\n TimeUnit.SECONDS.sleep(5);\n subscriber.dispose();\n```\n\n\n[Jackson JSON serializer]: https://mvnrepository.com/artifact/com.azure/azure-core-serializer-json-jackson\n[GSON JSON serializer]: https://mvnrepository.com/artifact/com.azure/azure-core-serializer-json-gson"
|
|
returns:
|
|
description: "A <xref uid=\"reactor.core.publisher.Mono\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Mono\"></xref> of <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> representing the serialized object."
|
|
type: "<a href=\"https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Mono.html\">Mono</a><<xref href=\"com.azure.core.util.BinaryData?alt=com.azure.core.util.BinaryData&text=BinaryData\" data-throw-if-not-resolved=\"False\" />>"
|
|
- uid: "com.azure.core.util.BinaryData.fromStream(java.io.InputStream)"
|
|
fullName: "com.azure.core.util.BinaryData.fromStream(InputStream inputStream)"
|
|
name: "fromStream(InputStream inputStream)"
|
|
nameWithType: "BinaryData.fromStream(InputStream inputStream)"
|
|
summary: "Creates an instance of <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> from the given <xref uid=\"java.io.InputStream\" data-throw-if-not-resolved=\"false\" data-raw-source=\"InputStream\"></xref>."
|
|
modifiers:
|
|
- "static"
|
|
parameters:
|
|
- description: "The <xref uid=\"java.io.InputStream\" data-throw-if-not-resolved=\"false\" data-raw-source=\"InputStream\"></xref> that <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> will represent."
|
|
name: "inputStream"
|
|
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/io/InputStream.html\">InputStream</a>"
|
|
syntax: "public static BinaryData fromStream(InputStream inputStream)"
|
|
desc: "Creates an instance of <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> from the given <xref uid=\"java.io.InputStream\" data-throw-if-not-resolved=\"false\" data-raw-source=\"InputStream\"></xref>. Depending on the type of inputStream, the BinaryData instance created may or may not allow reading the content more than once. The stream content is not cached if the stream is not read into a format that requires the content to be fully read into memory.\n\n**NOTE:** The <xref uid=\"java.io.InputStream\" data-throw-if-not-resolved=\"false\" data-raw-source=\"InputStream\"></xref> is not closed by this function.\n\n**Create an instance from an InputStream**\n\n```java\nfinal ByteArrayInputStream inputStream = new ByteArrayInputStream(\"Some Data\".getBytes(StandardCharsets.UTF_8));\n BinaryData binaryData = BinaryData.fromStream(inputStream);\n System.out.println(binaryData);\n```"
|
|
returns:
|
|
description: "A <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> representing the <xref uid=\"java.io.InputStream\" data-throw-if-not-resolved=\"false\" data-raw-source=\"InputStream\"></xref>."
|
|
type: "<xref href=\"com.azure.core.util.BinaryData?alt=com.azure.core.util.BinaryData&text=BinaryData\" data-throw-if-not-resolved=\"False\" />"
|
|
- uid: "com.azure.core.util.BinaryData.fromStream(java.io.InputStream,java.lang.Long)"
|
|
fullName: "com.azure.core.util.BinaryData.fromStream(InputStream inputStream, Long length)"
|
|
name: "fromStream(InputStream inputStream, Long length)"
|
|
nameWithType: "BinaryData.fromStream(InputStream inputStream, Long length)"
|
|
summary: "Creates an instance of <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> from the given <xref uid=\"java.io.InputStream\" data-throw-if-not-resolved=\"false\" data-raw-source=\"InputStream\"></xref>."
|
|
modifiers:
|
|
- "static"
|
|
parameters:
|
|
- description: "The <xref uid=\"java.io.InputStream\" data-throw-if-not-resolved=\"false\" data-raw-source=\"InputStream\"></xref> that <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> will represent."
|
|
name: "inputStream"
|
|
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/io/InputStream.html\">InputStream</a>"
|
|
- description: "The length of <code>data</code> in bytes."
|
|
name: "length"
|
|
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Long.html\">Long</a>"
|
|
syntax: "public static BinaryData fromStream(InputStream inputStream, Long length)"
|
|
desc: "Creates an instance of <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> from the given <xref uid=\"java.io.InputStream\" data-throw-if-not-resolved=\"false\" data-raw-source=\"InputStream\"></xref>. Depending on the type of inputStream, the BinaryData instance created may or may not allow reading the content more than once. The stream content is not cached if the stream is not read into a format that requires the content to be fully read into memory.\n\n**NOTE:** The <xref uid=\"java.io.InputStream\" data-throw-if-not-resolved=\"false\" data-raw-source=\"InputStream\"></xref> is not closed by this function.\n\n**Create an instance from an InputStream**\n\n```java\nbyte[] bytes = \"Some Data\".getBytes(StandardCharsets.UTF_8);\n final ByteArrayInputStream inputStream = new ByteArrayInputStream(bytes);\n BinaryData binaryData = BinaryData.fromStream(inputStream, (long) bytes.length);\n System.out.println(binaryData);\n```"
|
|
returns:
|
|
description: "A <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> representing the <xref uid=\"java.io.InputStream\" data-throw-if-not-resolved=\"false\" data-raw-source=\"InputStream\"></xref>."
|
|
type: "<xref href=\"com.azure.core.util.BinaryData?alt=com.azure.core.util.BinaryData&text=BinaryData\" data-throw-if-not-resolved=\"False\" />"
|
|
- uid: "com.azure.core.util.BinaryData.fromStreamAsync(java.io.InputStream)"
|
|
fullName: "com.azure.core.util.BinaryData.fromStreamAsync(InputStream inputStream)"
|
|
name: "fromStreamAsync(InputStream inputStream)"
|
|
nameWithType: "BinaryData.fromStreamAsync(InputStream inputStream)"
|
|
summary: "Creates an instance of <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> from the given <xref uid=\"java.io.InputStream\" data-throw-if-not-resolved=\"false\" data-raw-source=\"InputStream\"></xref>."
|
|
modifiers:
|
|
- "static"
|
|
parameters:
|
|
- description: "The <xref uid=\"java.io.InputStream\" data-throw-if-not-resolved=\"false\" data-raw-source=\"InputStream\"></xref> that <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> will represent."
|
|
name: "inputStream"
|
|
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/io/InputStream.html\">InputStream</a>"
|
|
syntax: "public static Mono<BinaryData> fromStreamAsync(InputStream inputStream)"
|
|
desc: "Creates an instance of <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> from the given <xref uid=\"java.io.InputStream\" data-throw-if-not-resolved=\"false\" data-raw-source=\"InputStream\"></xref>. **NOTE:** The <xref uid=\"java.io.InputStream\" data-throw-if-not-resolved=\"false\" data-raw-source=\"InputStream\"></xref> is not closed by this function.\n\n**Create an instance from an InputStream**\n\n```java\nfinal ByteArrayInputStream inputStream = new ByteArrayInputStream(\"Some Data\".getBytes(StandardCharsets.UTF_8));\n\n Mono<BinaryData> binaryDataMono = BinaryData.fromStreamAsync(inputStream);\n\n Disposable subscriber = binaryDataMono\n .map(binaryData -> {\n System.out.println(binaryData.toString());\n return true;\n })\n .subscribe();\n\n // So that your program wait for above subscribe to complete.\n TimeUnit.SECONDS.sleep(5);\n subscriber.dispose();\n```"
|
|
returns:
|
|
description: "A <xref uid=\"reactor.core.publisher.Mono\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Mono\"></xref> of <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> representing the <xref uid=\"java.io.InputStream\" data-throw-if-not-resolved=\"false\" data-raw-source=\"InputStream\"></xref>."
|
|
type: "<a href=\"https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Mono.html\">Mono</a><<xref href=\"com.azure.core.util.BinaryData?alt=com.azure.core.util.BinaryData&text=BinaryData\" data-throw-if-not-resolved=\"False\" />>"
|
|
- uid: "com.azure.core.util.BinaryData.fromStreamAsync(java.io.InputStream,java.lang.Long)"
|
|
fullName: "com.azure.core.util.BinaryData.fromStreamAsync(InputStream inputStream, Long length)"
|
|
name: "fromStreamAsync(InputStream inputStream, Long length)"
|
|
nameWithType: "BinaryData.fromStreamAsync(InputStream inputStream, Long length)"
|
|
summary: "Creates an instance of <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> from the given <xref uid=\"java.io.InputStream\" data-throw-if-not-resolved=\"false\" data-raw-source=\"InputStream\"></xref>."
|
|
modifiers:
|
|
- "static"
|
|
parameters:
|
|
- description: "The <xref uid=\"java.io.InputStream\" data-throw-if-not-resolved=\"false\" data-raw-source=\"InputStream\"></xref> that <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> will represent."
|
|
name: "inputStream"
|
|
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/io/InputStream.html\">InputStream</a>"
|
|
- description: "The length of <code>data</code> in bytes."
|
|
name: "length"
|
|
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Long.html\">Long</a>"
|
|
syntax: "public static Mono<BinaryData> fromStreamAsync(InputStream inputStream, Long length)"
|
|
desc: "Creates an instance of <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> from the given <xref uid=\"java.io.InputStream\" data-throw-if-not-resolved=\"false\" data-raw-source=\"InputStream\"></xref>. **NOTE:** The <xref uid=\"java.io.InputStream\" data-throw-if-not-resolved=\"false\" data-raw-source=\"InputStream\"></xref> is not closed by this function.\n\n**Create an instance from an InputStream**\n\n```java\nbyte[] bytes = \"Some Data\".getBytes(StandardCharsets.UTF_8);\n final ByteArrayInputStream inputStream = new ByteArrayInputStream(bytes);\n\n Mono<BinaryData> binaryDataMono = BinaryData.fromStreamAsync(inputStream, (long) bytes.length);\n\n Disposable subscriber = binaryDataMono\n .map(binaryData -> {\n System.out.println(binaryData.toString());\n return true;\n })\n .subscribe();\n\n // So that your program wait for above subscribe to complete.\n TimeUnit.SECONDS.sleep(5);\n subscriber.dispose();\n```"
|
|
returns:
|
|
description: "A <xref uid=\"reactor.core.publisher.Mono\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Mono\"></xref> of <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> representing the <xref uid=\"java.io.InputStream\" data-throw-if-not-resolved=\"false\" data-raw-source=\"InputStream\"></xref>."
|
|
type: "<a href=\"https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Mono.html\">Mono</a><<xref href=\"com.azure.core.util.BinaryData?alt=com.azure.core.util.BinaryData&text=BinaryData\" data-throw-if-not-resolved=\"False\" />>"
|
|
- uid: "com.azure.core.util.BinaryData.fromString(java.lang.String)"
|
|
fullName: "com.azure.core.util.BinaryData.fromString(String data)"
|
|
name: "fromString(String data)"
|
|
nameWithType: "BinaryData.fromString(String data)"
|
|
summary: "Creates an instance of <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> from the given <xref uid=\"java.lang.String\" data-throw-if-not-resolved=\"false\" data-raw-source=\"String\"></xref>."
|
|
modifiers:
|
|
- "static"
|
|
parameters:
|
|
- description: "The <xref uid=\"java.lang.String\" data-throw-if-not-resolved=\"false\" data-raw-source=\"String\"></xref> that <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> will represent."
|
|
name: "data"
|
|
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
|
|
syntax: "public static BinaryData fromString(String data)"
|
|
desc: "Creates an instance of <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> from the given <xref uid=\"java.lang.String\" data-throw-if-not-resolved=\"false\" data-raw-source=\"String\"></xref>.\n\nThe <xref uid=\"java.lang.String\" data-throw-if-not-resolved=\"false\" data-raw-source=\"String\"></xref> is converted into bytes using <xref uid=\"java.lang.String.getBytes*\" data-throw-if-not-resolved=\"false\" data-raw-source=\"String#getBytes(Charset)\"></xref> passing <xref uid=\"\" data-throw-if-not-resolved=\"false\" data-raw-source=\"StandardCharsets#UTF_8\"></xref>.\n\n**Create an instance from a String**\n\n```java\nfinal String data = \"Some Data\";\n // Following will use default character set as StandardCharsets.UTF_8\n BinaryData binaryData = BinaryData.fromString(data);\n System.out.println(binaryData.toString());\n```"
|
|
returns:
|
|
description: "A <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> representing the <xref uid=\"java.lang.String\" data-throw-if-not-resolved=\"false\" data-raw-source=\"String\"></xref>."
|
|
type: "<xref href=\"com.azure.core.util.BinaryData?alt=com.azure.core.util.BinaryData&text=BinaryData\" data-throw-if-not-resolved=\"False\" />"
|
|
- uid: "com.azure.core.util.BinaryData.getLength()"
|
|
fullName: "com.azure.core.util.BinaryData.getLength()"
|
|
name: "getLength()"
|
|
nameWithType: "BinaryData.getLength()"
|
|
summary: "Returns the length of the content, if it is known."
|
|
syntax: "public Long getLength()"
|
|
desc: "Returns the length of the content, if it is known. The length can be `null` if the source did not specify the length or the length cannot be determined without reading the whole content."
|
|
returns:
|
|
description: "the length of the content, if it is known."
|
|
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Long.html\">Long</a>"
|
|
- uid: "com.azure.core.util.BinaryData.isReplayable()"
|
|
fullName: "com.azure.core.util.BinaryData.isReplayable()"
|
|
name: "isReplayable()"
|
|
nameWithType: "BinaryData.isReplayable()"
|
|
summary: "Returns a flag indicating whether the content can be repeatedly consumed using all accessors including <xref uid=\"com.azure.core.util.BinaryData.toStream()\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#toStream()\"></xref> and <xref uid=\"com.azure.core.util.BinaryData.toFluxByteBuffer()\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#toFluxByteBuffer()\"></xref>"
|
|
syntax: "public boolean isReplayable()"
|
|
desc: "Returns a flag indicating whether the content can be repeatedly consumed using all accessors including <xref uid=\"com.azure.core.util.BinaryData.toStream()\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#toStream()\"></xref> and <xref uid=\"com.azure.core.util.BinaryData.toFluxByteBuffer()\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#toFluxByteBuffer()\"></xref>\n\nReplayability does not imply thread-safety. The caller must not use data accessors simultaneously regardless of what this method returns.\n\n```java\nBinaryData binaryData = binaryDataProducer();\n\n if (!binaryData.isReplayable()) {\n binaryData = binaryData.toReplayableBinaryData();\n }\n\n streamConsumer(binaryData.toStream());\n streamConsumer(binaryData.toStream());\n```\n\n```java\nMono.fromCallable(this::binaryDataProducer)\n .flatMap(binaryData -> {\n if (binaryData.isReplayable()) {\n return Mono.just(binaryData);\n } else {\n return binaryData.toReplayableBinaryDataAsync();\n }\n })\n .flatMap(replayableBinaryData ->\n fluxConsumer(replayableBinaryData.toFluxByteBuffer())\n .then(fluxConsumer(replayableBinaryData.toFluxByteBuffer())))\n .subscribe();\n```"
|
|
returns:
|
|
description: "a flag indicating whether the content can be repeatedly consumed using all accessors."
|
|
type: "<xref href=\"boolean?alt=boolean&text=boolean\" data-throw-if-not-resolved=\"False\" />"
|
|
- uid: "com.azure.core.util.BinaryData.toByteBuffer()"
|
|
fullName: "com.azure.core.util.BinaryData.toByteBuffer()"
|
|
name: "toByteBuffer()"
|
|
nameWithType: "BinaryData.toByteBuffer()"
|
|
summary: "Returns a read-only <xref uid=\"java.nio.ByteBuffer\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ByteBuffer\"></xref> representation of this <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref>."
|
|
syntax: "public ByteBuffer toByteBuffer()"
|
|
desc: "Returns a read-only <xref uid=\"java.nio.ByteBuffer\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ByteBuffer\"></xref> representation of this <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref>.\n\nAttempting to mutate the returned <xref uid=\"java.nio.ByteBuffer\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ByteBuffer\"></xref> will throw a <xref uid=\"\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ReadOnlyBufferException\"></xref>.\n\n**Get a read-only ByteBuffer from the BinaryData**\n\n```java\nfinal byte[] data = \"Some Data\".getBytes(StandardCharsets.UTF_8);\n BinaryData binaryData = BinaryData.fromBytes(data);\n final byte[] bytes = new byte[data.length];\n binaryData.toByteBuffer().get(bytes, 0, data.length);\n System.out.println(new String(bytes));\n```"
|
|
returns:
|
|
description: "A read-only <xref uid=\"java.nio.ByteBuffer\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ByteBuffer\"></xref> representing the <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref>."
|
|
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/nio/ByteBuffer.html\">ByteBuffer</a>"
|
|
- uid: "com.azure.core.util.BinaryData.toBytes()"
|
|
fullName: "com.azure.core.util.BinaryData.toBytes()"
|
|
name: "toBytes()"
|
|
nameWithType: "BinaryData.toBytes()"
|
|
summary: "Returns a byte array representation of this <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref>."
|
|
syntax: "public byte[] toBytes()"
|
|
desc: "Returns a byte array representation of this <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref>.\n\nThis method returns a reference to the underlying byte array. Modifying the contents of the returned byte array may change the content of this BinaryData instance. If the content source of this BinaryData instance is a file, an <xref uid=\"java.io.InputStream\" data-throw-if-not-resolved=\"false\" data-raw-source=\"InputStream\"></xref>, or a `Flux` the source is not modified. To safely update the byte array, it is recommended to make a copy of the contents first.\n\nIf the <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> is larger than the maximum size allowed for a `byte[]` this will throw an <xref uid=\"java.lang.IllegalStateException\" data-throw-if-not-resolved=\"false\" data-raw-source=\"IllegalStateException\"></xref>."
|
|
returns:
|
|
description: "A byte array representing this <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref>."
|
|
type: "<xref href=\"byte?alt=byte&text=byte\" data-throw-if-not-resolved=\"False\" />[]"
|
|
- uid: "com.azure.core.util.BinaryData.toFluxByteBuffer()"
|
|
fullName: "com.azure.core.util.BinaryData.toFluxByteBuffer()"
|
|
name: "toFluxByteBuffer()"
|
|
nameWithType: "BinaryData.toFluxByteBuffer()"
|
|
summary: "Returns the content of this <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> instance as a flux of <xref uid=\"java.nio.ByteBuffer\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ByteBuffers\"></xref>."
|
|
syntax: "public Flux<ByteBuffer> toFluxByteBuffer()"
|
|
desc: "Returns the content of this <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> instance as a flux of <xref uid=\"java.nio.ByteBuffer\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ByteBuffers\"></xref>. The content is not read from the underlying data source until the <xref uid=\"reactor.core.publisher.Flux\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Flux\"></xref> is subscribed to."
|
|
returns:
|
|
description: "the content of this <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> instance as a flux of <xref uid=\"java.nio.ByteBuffer\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ByteBuffers\"></xref>."
|
|
type: "<a href=\"https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Flux.html\">Flux</a><<a href=\"https://docs.oracle.com/javase/8/docs/api/java/nio/ByteBuffer.html\">ByteBuffer</a>>"
|
|
- uid: "com.azure.core.util.BinaryData.toReplayableBinaryData()"
|
|
fullName: "com.azure.core.util.BinaryData.toReplayableBinaryData()"
|
|
name: "toReplayableBinaryData()"
|
|
nameWithType: "BinaryData.toReplayableBinaryData()"
|
|
summary: "Converts the <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> into a <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> that is replayable, i.<wbr>e."
|
|
syntax: "public BinaryData toReplayableBinaryData()"
|
|
desc: "Converts the <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> into a <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> that is replayable, i.e. content can be consumed repeatedly using all accessors including <xref uid=\"com.azure.core.util.BinaryData.toStream()\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#toStream()\"></xref> and <xref uid=\"com.azure.core.util.BinaryData.toFluxByteBuffer()\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#toFluxByteBuffer()\"></xref>\n\nA <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> that is already replayable is returned as is. Otherwise techniques like marking and resetting a stream or buffering in memory are employed to assure replayability.\n\nReplayability does not imply thread-safety. The caller must not use data accessors of returned <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> simultaneously.\n\n```java\nBinaryData binaryData = binaryDataProducer();\n\n if (!binaryData.isReplayable()) {\n binaryData = binaryData.toReplayableBinaryData();\n }\n\n streamConsumer(binaryData.toStream());\n streamConsumer(binaryData.toStream());\n```"
|
|
returns:
|
|
description: "Replayable <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref>."
|
|
type: "<xref href=\"com.azure.core.util.BinaryData?alt=com.azure.core.util.BinaryData&text=BinaryData\" data-throw-if-not-resolved=\"False\" />"
|
|
- uid: "com.azure.core.util.BinaryData.toReplayableBinaryDataAsync()"
|
|
fullName: "com.azure.core.util.BinaryData.toReplayableBinaryDataAsync()"
|
|
name: "toReplayableBinaryDataAsync()"
|
|
nameWithType: "BinaryData.toReplayableBinaryDataAsync()"
|
|
summary: "Converts the <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> into a <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> that is replayable, i.<wbr>e."
|
|
syntax: "public Mono<BinaryData> toReplayableBinaryDataAsync()"
|
|
desc: "Converts the <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> into a <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> that is replayable, i.e. content can be consumed repeatedly using all accessors including <xref uid=\"com.azure.core.util.BinaryData.toStream()\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#toStream()\"></xref> and <xref uid=\"com.azure.core.util.BinaryData.toFluxByteBuffer()\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#toFluxByteBuffer()\"></xref>\n\nA <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> that is already replayable is returned as is. Otherwise techniques like marking and resetting a stream or buffering in memory are employed to assure replayability.\n\nReplayability does not imply thread-safety. The caller must not use data accessors of returned <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> simultaneously.\n\n```java\nMono.fromCallable(this::binaryDataProducer)\n .flatMap(binaryData -> {\n if (binaryData.isReplayable()) {\n return Mono.just(binaryData);\n } else {\n return binaryData.toReplayableBinaryDataAsync();\n }\n })\n .flatMap(replayableBinaryData ->\n fluxConsumer(replayableBinaryData.toFluxByteBuffer())\n .then(fluxConsumer(replayableBinaryData.toFluxByteBuffer())))\n .subscribe();\n```"
|
|
returns:
|
|
description: "A <xref uid=\"reactor.core.publisher.Mono\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Mono\"></xref> of <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> representing the replayable <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref>."
|
|
type: "<a href=\"https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Mono.html\">Mono</a><<xref href=\"com.azure.core.util.BinaryData?alt=com.azure.core.util.BinaryData&text=BinaryData\" data-throw-if-not-resolved=\"False\" />>"
|
|
- uid: "com.azure.core.util.BinaryData.toStream()"
|
|
fullName: "com.azure.core.util.BinaryData.toStream()"
|
|
name: "toStream()"
|
|
nameWithType: "BinaryData.toStream()"
|
|
summary: "Returns an <xref uid=\"java.io.InputStream\" data-throw-if-not-resolved=\"false\" data-raw-source=\"InputStream\"></xref> representation of this <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref>."
|
|
syntax: "public InputStream toStream()"
|
|
desc: "Returns an <xref uid=\"java.io.InputStream\" data-throw-if-not-resolved=\"false\" data-raw-source=\"InputStream\"></xref> representation of this <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref>.\n\n**Get an InputStream from the BinaryData**\n\n```java\nfinal byte[] data = \"Some Data\".getBytes(StandardCharsets.UTF_8);\n BinaryData binaryData = BinaryData.fromStream(new ByteArrayInputStream(data), (long) data.length);\n final byte[] bytes = new byte[data.length];\n try (InputStream inputStream = binaryData.toStream()) {\n inputStream.read(bytes, 0, data.length);\n System.out.println(new String(bytes));\n }\n```"
|
|
returns:
|
|
description: "An <xref uid=\"java.io.InputStream\" data-throw-if-not-resolved=\"false\" data-raw-source=\"InputStream\"></xref> representing the <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref>."
|
|
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/io/InputStream.html\">InputStream</a>"
|
|
- uid: "com.azure.core.util.BinaryData.toString()"
|
|
fullName: "com.azure.core.util.BinaryData.toString()"
|
|
name: "toString()"
|
|
nameWithType: "BinaryData.toString()"
|
|
summary: "Returns a <xref uid=\"java.lang.String\" data-throw-if-not-resolved=\"false\" data-raw-source=\"String\"></xref> representation of this <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> by converting its data using the UTF-8 character set."
|
|
overridden: "java.lang.Object.toString()"
|
|
syntax: "public String toString()"
|
|
desc: "Returns a <xref uid=\"java.lang.String\" data-throw-if-not-resolved=\"false\" data-raw-source=\"String\"></xref> representation of this <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> by converting its data using the UTF-8 character set. A new instance of String is created each time this method is called.\n\nIf the <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> is larger than the maximum size allowed for a <xref uid=\"java.lang.String\" data-throw-if-not-resolved=\"false\" data-raw-source=\"String\"></xref> this will throw an <xref uid=\"java.lang.IllegalStateException\" data-throw-if-not-resolved=\"false\" data-raw-source=\"IllegalStateException\"></xref>."
|
|
returns:
|
|
description: "A <xref uid=\"java.lang.String\" data-throw-if-not-resolved=\"false\" data-raw-source=\"String\"></xref> representing this <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref>."
|
|
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
|
|
- uid: "com.azure.core.util.BinaryData.writeTo(com.azure.json.JsonWriter)"
|
|
fullName: "com.azure.core.util.BinaryData.writeTo(JsonWriter jsonWriter)"
|
|
name: "writeTo(JsonWriter jsonWriter)"
|
|
nameWithType: "BinaryData.writeTo(JsonWriter jsonWriter)"
|
|
summary: "Writes the contents of this <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> to the given <xref uid=\"com.azure.json.JsonWriter\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonWriter\"></xref>."
|
|
parameters:
|
|
- description: "The <xref uid=\"com.azure.json.JsonWriter\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonWriter\"></xref> to write the contents of this <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> to."
|
|
name: "jsonWriter"
|
|
type: "<xref href=\"com.azure.json.JsonWriter?alt=com.azure.json.JsonWriter&text=JsonWriter\" data-throw-if-not-resolved=\"False\" />"
|
|
syntax: "public void writeTo(JsonWriter jsonWriter)"
|
|
exceptions:
|
|
- description: "If <code>jsonWriter</code> is null."
|
|
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html\">IOException</a>"
|
|
desc: "Writes the contents of this <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> to the given <xref uid=\"com.azure.json.JsonWriter\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonWriter\"></xref>.\n\nThis method does not close or flush the <xref uid=\"com.azure.json.JsonWriter\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonWriter\"></xref>.\n\nThe contents of this <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> will be written without buffering. If the underlying data source isn't <xref uid=\"com.azure.core.util.BinaryData.isReplayable()\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#isReplayable()\"></xref>, after this method is called the <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> will be consumed and can't be read again. If it needs to be read again, use <xref uid=\"com.azure.core.util.BinaryData.toReplayableBinaryData()\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#toReplayableBinaryData()\"></xref> to create a replayable copy."
|
|
- uid: "com.azure.core.util.BinaryData.writeTo(java.io.OutputStream)"
|
|
fullName: "com.azure.core.util.BinaryData.writeTo(OutputStream outputStream)"
|
|
name: "writeTo(OutputStream outputStream)"
|
|
nameWithType: "BinaryData.writeTo(OutputStream outputStream)"
|
|
summary: "Writes the contents of this <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> to the given <xref uid=\"java.io.OutputStream\" data-throw-if-not-resolved=\"false\" data-raw-source=\"OutputStream\"></xref>."
|
|
parameters:
|
|
- description: "The <xref uid=\"java.io.OutputStream\" data-throw-if-not-resolved=\"false\" data-raw-source=\"OutputStream\"></xref> to write the contents of this <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> to."
|
|
name: "outputStream"
|
|
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/io/OutputStream.html\">OutputStream</a>"
|
|
syntax: "public void writeTo(OutputStream outputStream)"
|
|
exceptions:
|
|
- description: "If <code>outputStream</code> is null."
|
|
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html\">IOException</a>"
|
|
desc: "Writes the contents of this <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> to the given <xref uid=\"java.io.OutputStream\" data-throw-if-not-resolved=\"false\" data-raw-source=\"OutputStream\"></xref>.\n\nThis method does not close the <xref uid=\"java.io.OutputStream\" data-throw-if-not-resolved=\"false\" data-raw-source=\"OutputStream\"></xref>.\n\nThe contents of this <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> will be written without buffering. If the underlying data source isn't <xref uid=\"com.azure.core.util.BinaryData.isReplayable()\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#isReplayable()\"></xref>, after this method is called the <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> will be consumed and can't be read again. If it needs to be read again, use <xref uid=\"com.azure.core.util.BinaryData.toReplayableBinaryData()\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#toReplayableBinaryData()\"></xref> to create a replayable copy."
|
|
- uid: "com.azure.core.util.BinaryData.writeTo(java.nio.channels.AsynchronousByteChannel)"
|
|
fullName: "com.azure.core.util.BinaryData.writeTo(AsynchronousByteChannel channel)"
|
|
name: "writeTo(AsynchronousByteChannel channel)"
|
|
nameWithType: "BinaryData.writeTo(AsynchronousByteChannel channel)"
|
|
summary: "Writes the contents of this <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> to the given <xref uid=\"java.nio.channels.AsynchronousByteChannel\" data-throw-if-not-resolved=\"false\" data-raw-source=\"AsynchronousByteChannel\"></xref>."
|
|
parameters:
|
|
- description: "The <xref uid=\"java.nio.channels.AsynchronousByteChannel\" data-throw-if-not-resolved=\"false\" data-raw-source=\"AsynchronousByteChannel\"></xref> to write the contents of this <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> to."
|
|
name: "channel"
|
|
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/nio/channels/AsynchronousByteChannel.html\">AsynchronousByteChannel</a>"
|
|
syntax: "public Mono<Void> writeTo(AsynchronousByteChannel channel)"
|
|
desc: "Writes the contents of this <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> to the given <xref uid=\"java.nio.channels.AsynchronousByteChannel\" data-throw-if-not-resolved=\"false\" data-raw-source=\"AsynchronousByteChannel\"></xref>.\n\nThis method does not close the <xref uid=\"java.nio.channels.AsynchronousByteChannel\" data-throw-if-not-resolved=\"false\" data-raw-source=\"AsynchronousByteChannel\"></xref>.\n\nThe contents of this <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> will be written without buffering. If the underlying data source isn't <xref uid=\"com.azure.core.util.BinaryData.isReplayable()\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#isReplayable()\"></xref>, after this method is called the <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> will be consumed and can't be read again. If it needs to be read again, use <xref uid=\"com.azure.core.util.BinaryData.toReplayableBinaryDataAsync()\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#toReplayableBinaryDataAsync()\"></xref> to create a replayable copy."
|
|
returns:
|
|
description: "A <xref uid=\"reactor.core.publisher.Mono\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Mono\"></xref> the completes once content has been written or had an error writing."
|
|
type: "<a href=\"https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Mono.html\">Mono</a><<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Void.html\">Void</a>>"
|
|
- uid: "com.azure.core.util.BinaryData.writeTo(java.nio.channels.WritableByteChannel)"
|
|
fullName: "com.azure.core.util.BinaryData.writeTo(WritableByteChannel channel)"
|
|
name: "writeTo(WritableByteChannel channel)"
|
|
nameWithType: "BinaryData.writeTo(WritableByteChannel channel)"
|
|
summary: "Writes the contents of this <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> to the given <xref uid=\"java.nio.channels.WritableByteChannel\" data-throw-if-not-resolved=\"false\" data-raw-source=\"WritableByteChannel\"></xref>."
|
|
parameters:
|
|
- description: "The <xref uid=\"java.nio.channels.WritableByteChannel\" data-throw-if-not-resolved=\"false\" data-raw-source=\"WritableByteChannel\"></xref> to write the contents of this <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> to."
|
|
name: "channel"
|
|
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/nio/channels/WritableByteChannel.html\">WritableByteChannel</a>"
|
|
syntax: "public void writeTo(WritableByteChannel channel)"
|
|
exceptions:
|
|
- description: "If <code>channel</code> is null."
|
|
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html\">IOException</a>"
|
|
desc: "Writes the contents of this <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> to the given <xref uid=\"java.nio.channels.WritableByteChannel\" data-throw-if-not-resolved=\"false\" data-raw-source=\"WritableByteChannel\"></xref>.\n\nThis method does not close the <xref uid=\"java.nio.channels.WritableByteChannel\" data-throw-if-not-resolved=\"false\" data-raw-source=\"WritableByteChannel\"></xref>.\n\nThe contents of this <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> will be written without buffering. If the underlying data source isn't <xref uid=\"com.azure.core.util.BinaryData.isReplayable()\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#isReplayable()\"></xref>, after this method is called the <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> will be consumed and can't be read again. If it needs to be read again, use <xref uid=\"com.azure.core.util.BinaryData.toReplayableBinaryData()\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#toReplayableBinaryData()\"></xref> to create a replayable copy."
|
|
type: "class"
|
|
desc: "BinaryData is a convenient data interchange class for use throughout the Azure SDK for Java. Put simply, BinaryData enables developers to bring data in from external sources, and read it back from Azure services, in formats that appeal to them. This leaves BinaryData, and the Azure SDK for Java, the task of converting this data into appropriate formats to be transferred to and from these external services. This enables developers to focus on their business logic, and enables the Azure SDK for Java to optimize operations for best performance.\n\nBinaryData in its simplest form can be thought of as a container for content. Often this content is already in-memory as a String, byte array, or an Object that can be serialized into a String or byte\\[\\]. When the BinaryData is about to be sent to an Azure Service, this in-memory content is copied into the network request and sent to the service.\n\nIn more performance critical scenarios, where copying data into memory results in increased memory pressure, it is possible to create a BinaryData instance from a stream of data. From this, BinaryData can be connected directly to the outgoing network connection so that the stream is read directly to the network, without needing to first be read into memory on the system. Similarly, it is possible to read a stream of data from a BinaryData returned from an Azure Service without it first being read into memory. In many situations, these streaming operations can drastically reduce the memory pressure in applications, and so it is encouraged that all developers very carefully consider their ability to use the most appropriate API in BinaryData whenever they encounter an client library that makes use of BinaryData.\n\nRefer to the documentation of each method in the BinaryData class to better understand its performance characteristics, and refer to the samples below to understand the common usage scenarios of this class.\n\n<xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> can be created from an <xref uid=\"java.io.InputStream\" data-throw-if-not-resolved=\"false\" data-raw-source=\"InputStream\"></xref>, a <xref uid=\"reactor.core.publisher.Flux\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Flux\"></xref> of <xref uid=\"java.nio.ByteBuffer\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ByteBuffer\"></xref>, a <xref uid=\"java.lang.String\" data-throw-if-not-resolved=\"false\" data-raw-source=\"String\"></xref>, an <xref uid=\"java.lang.Object\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Object\"></xref>, a <xref uid=\"java.nio.file.Path\" data-throw-if-not-resolved=\"false\" data-raw-source=\"file\"></xref>, or a byte array.\n\n**A note on data mutability**\n\n<xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> does not copy data on construction. BinaryData keeps a reference to the source content and is accessed when a read request is made. So, any modifications to the underlying source before the content is read can result in undefined behavior.\n\nTo create an instance of <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref>, use the various static factory methods available. They all start with `'from'` prefix, for example <xref uid=\"com.azure.core.util.BinaryData.fromBytes(byte[])\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData#fromBytes(byte[])\"></xref>.\n\n**Create an instance from a byte array**\n\n```java\nfinal byte[] data = \"Some Data\".getBytes(StandardCharsets.UTF_8);\n BinaryData binaryData = BinaryData.fromBytes(data);\n System.out.println(new String(binaryData.toBytes(), StandardCharsets.UTF_8));\n```\n\n**Create an instance from a String**\n\n```java\nfinal String data = \"Some Data\";\n // Following will use default character set as StandardCharsets.UTF_8\n BinaryData binaryData = BinaryData.fromString(data);\n System.out.println(binaryData.toString());\n```\n\n**Create an instance from an InputStream**\n\n```java\nfinal ByteArrayInputStream inputStream = new ByteArrayInputStream(\"Some Data\".getBytes(StandardCharsets.UTF_8));\n BinaryData binaryData = BinaryData.fromStream(inputStream);\n System.out.println(binaryData);\n```\n\n**Create an instance from an Object**\n\n```java\nfinal Person data = new Person().setName(\"John\");\n\n // Provide your custom serializer or use Azure provided serializers.\n // https://central.sonatype.com/artifact/com.azure/azure-core-serializer-json-jackson or\n // https://central.sonatype.com/artifact/com.azure/azure-core-serializer-json-gson\n BinaryData binaryData = BinaryData.fromObject(data);\n\n System.out.println(binaryData);\n```\n\n**Create an instance from `Flux`**\n\n```java\nfinal byte[] data = \"Some Data\".getBytes(StandardCharsets.UTF_8);\n final Flux<ByteBuffer> dataFlux = Flux.just(ByteBuffer.wrap(data));\n\n Mono<BinaryData> binaryDataMono = BinaryData.fromFlux(dataFlux);\n\n Disposable subscriber = binaryDataMono\n .map(binaryData -> {\n System.out.println(binaryData.toString());\n return true;\n })\n .subscribe();\n\n // So that your program wait for above subscribe to complete.\n TimeUnit.SECONDS.sleep(5);\n subscriber.dispose();\n```\n\n**Create an instance from a file**\n\n```java\nBinaryData binaryData = BinaryData.fromFile(new File(\"path/to/file\").toPath());\n System.out.println(new String(binaryData.toBytes(), StandardCharsets.UTF_8));\n```"
|
|
metadata: {}
|
|
package: "com.azure.core.util"
|
|
artifact: com.azure:azure-core:1.54.0
|