- Type Parameters:
T- the Java type this codec handles.
public interface CursorCodec<T>
Encodes and decodes a single scalar value for cursor serialization.
A CursorCodec handles the binary representation of one Java type within an opaque cursor string
(produced by Scrollable.toCursor() and consumed by Scrollable.from(String)). Storm
provides built-in codecs for common scalar types (primitives, String, UUID, date/time types,
BigDecimal). Additional codecs can be registered via CursorCodecProvider.
A type is eligible for cursor serialization if it is a scalar mapped value that is orderable in SQL and uniquely reconstructable from its encoded representation. Entity types, collections, JSON objects, and other composite types are not eligible.
- Since:
- 1.11
-
Method Summary
Modifier and TypeMethodDescriptionread(DataInputStream in) Reads a value from the input stream.voidwrite(DataOutputStream out, T value) Writes a non-null value to the output stream.
-
Method Details
-
write
Writes a non-null value to the output stream.- Parameters:
out- the data output stream.value- the value to write (never null).- Throws:
IOException- if an I/O error occurs.
-
read
Reads a value from the input stream.- Parameters:
in- the data input stream.- Returns:
- the deserialized value (never null).
- Throws:
IOException- if an I/O error occurs or the data is malformed.
-