Package org.opensearch.client.util
Interface BinaryData
- All Superinterfaces:
JsonpSerializable
- All Known Implementing Classes:
ByteArrayBinaryData
Binary data with an associated content type.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionReturn this data as aByteBuffer.Return this data as anInputStream.Get the content type of this binary data.booleanCan this object be consumed several times?static BinaryDatastatic BinaryDatastatic BinaryDataof(Object value, JsonpMapper mapper) Create aBinaryDatafrom a value and a JSON mapper.longsize()Get the estimated size in bytes of the data.voidwriteTo(OutputStream out) Write this data to an output stream.Methods inherited from interface org.opensearch.client.json.JsonpSerializable
serialize
-
Field Details
-
_DESERIALIZER
-
-
Method Details
-
contentType
String contentType()Get the content type of this binary data.- Returns:
- the content type (e.g., "application/json")
-
writeTo
Write this data to an output stream.- Throws:
IllegalStateException- if the content has already been consumed and the object isn't replayable.IOException
-
asByteBuffer
Return this data as aByteBuffer.- Throws:
IllegalStateException- if the content has already been consumed and the object isn't replayable.IOException
-
asInputStream
Return this data as anInputStream.- Throws:
IllegalStateException- if the content has already been consumed and the object isn't replayable.IOException
-
isRepeatable
boolean isRepeatable()Can this object be consumed several times? -
size
long size()Get the estimated size in bytes of the data.- Returns:
- the estimated size, or
-1if the value cannot be estimated or if the data has already been consumed.
-
of
Create aBinaryDatafrom a value and a JSON mapper. The binary content is the result of serializingvaluewithmapper. Returnsnullifvalueis null.Note that the result's content-type can be different from
"application/json"if the JSON mapper is setup to produce other representations such as CBOR or SMILE. -
of
-
of
-