public interface BinaryDataType extends DataType<Binary>
Binary values can be used to store and transmit arbitrary
information. The responsibility for formatting and interpreting the
information belongs solely to the application. Before using Binary for a
topic, consider other data types such as JSON; these may provide a
simpler interface for your application.
The implementation provides support for binary
deltas.
DataTypes.binary()| Modifier and Type | Method and Description |
|---|---|
DeltaType<Binary,BinaryDelta> |
binaryDeltaType()
Returns support for binary deltas.
|
<T> T |
readAs(Class<T> classOfT,
byte[] bytes)
Create a value of a compatible class from binary.
|
<T> T |
readAs(Class<T> classOfT,
byte[] bytes,
int offset,
int length)
Create a value of a compatible class from a binary.
|
<T> T |
readAs(Class<T> classOfT,
Bytes bytes)
Create a value of a compatible class from binary.
|
Binary |
readValue(byte[] bytes)
Create a value from binary.
|
Binary |
readValue(byte[] bytes,
int offset,
int length)
Create a value from binary.
|
Binary |
readValue(Bytes bytes)
Create a value from binary.
|
canReadAs, deltaType, deltaType, getTypeName, toBytes, validate, writeValueDeltaType<Binary,BinaryDelta> binaryDeltaType()
Equivalent to calling deltaType(BinaryDelta.class).
binaryDeltaType in interface DataType<Binary>Binary readValue(byte[] bytes, int offset, int length) throws IndexOutOfBoundsException
Implementations can choose not to fully validate values when they are
read, but instead defer parsing until it is required. See
DataType.validate(Object).
There are no invalid Binary instances, so this method does not throw
InvalidDataException.
readValue in interface DataType<Binary>bytes - The binary data. The implementation may re-use the array to
avoid copying so the caller must ensure the array is not modified.offset - start of the data within byteslength - length of the data within bytesIndexOutOfBoundsException - if either offset or
length is negative, or
offset + length > bytes.lengthBinary readValue(byte[] bytes)
readValue(in, 0, in.length).
There are no invalid Binary instances, so this method does not throw
InvalidDataException.
Binary readValue(Bytes bytes)
readValue(bytes.toByteArray()).
There are no invalid Binary instances, so this method does not throw
InvalidDataException.
<T> T readAs(Class<T> classOfT, byte[] bytes, int offset, int length) throws IllegalArgumentException, IndexOutOfBoundsException
If valueType is incompatible with this data type, this method
will throw an IllegalArgumentException. Compatibility can be tested with
DataType.canReadAs(Class).
There are no invalid Binary instances, so this method does not throw
InvalidDataException.
readAs in interface DataType<Binary>T - type of classOfTclassOfT - the type of the resultbytes - The binary data. The implementation may re-use the array to
avoid copying so the caller must ensure the array is not modified.offset - start of the data within byteslength - length of the data within bytesIllegalArgumentException - if classOfT is
incompatible with this data typeIndexOutOfBoundsException - if either offset or
length is negative, or
offset + length > bytes.length<T> T readAs(Class<T> classOfT, byte[] bytes) throws IllegalArgumentException
readAs(classOfT, in, 0,
in.length).
There are no invalid Binary instances, so this method does not throw
InvalidDataException.
readAs in interface DataType<Binary>T - type of classOfTclassOfT - the type of the resultbytes - The binary data. The implementation may re-use the array to
avoid copying so the caller must ensure the array is not modified.IllegalArgumentException - if classOfT is
incompatible with this data type<T> T readAs(Class<T> classOfT, Bytes bytes) throws IllegalArgumentException
readAs(classOfT, bytes.toByteArray()).
There are no invalid Binary instances, so this method does not throw
InvalidDataException.
readAs in interface DataType<Binary>T - type of classOfTclassOfT - the type of the resultbytes - the binary dataIllegalArgumentException - if classOfT is
incompatible with this data typeCopyright © 2025 DiffusionData Limited. All rights reserved.