Package org.opensearch.client.util
Class ByteArrayBinaryData
java.lang.Object
org.opensearch.client.util.ByteArrayBinaryData
- All Implemented Interfaces:
JsonpSerializable,BinaryData
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionByteArrayBinaryData(byte[] bytes, int offset, int length, String contentType) ByteArrayBinaryData(byte[] bytes, String contentType) Copy anotherBinaryData. -
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?voidserialize(jakarta.json.stream.JsonGenerator generator, JsonpMapper mapper) longsize()Get the estimated size in bytes of the data.voidwriteTo(OutputStream out) Write this data to an output stream.
-
Field Details
-
_DESERIALIZER
-
-
Constructor Details
-
ByteArrayBinaryData
-
ByteArrayBinaryData
-
ByteArrayBinaryData
Copy anotherBinaryData. Typically used to make a replayableBinaryDatafrom a non-replayable one.- Throws:
IOException
-
-
Method Details
-
contentType
Get the content type of this binary data.- Specified by:
contentTypein interfaceBinaryData- Returns:
- the content type (e.g., "application/json")
-
writeTo
Write this data to an output stream.- Specified by:
writeToin interfaceBinaryData- Throws:
IOException
-
size
public long size()Get the estimated size in bytes of the data.- Specified by:
sizein interfaceBinaryData- Returns:
- the estimated size, or
-1if the value cannot be estimated or if the data has already been consumed.
-
asByteBuffer
Return this data as aByteBuffer.- Specified by:
asByteBufferin interfaceBinaryData
-
asInputStream
Return this data as anInputStream.- Specified by:
asInputStreamin interfaceBinaryData
-
isRepeatable
public boolean isRepeatable()Can this object be consumed several times?- Specified by:
isRepeatablein interfaceBinaryData
-
serialize
- Specified by:
serializein interfaceJsonpSerializable
-