Record Class RecordHeader
java.lang.Object
java.lang.Record
io.krabka.streams.columnar.RecordHeader
- Record Components:
key- the header keyvalue- the header value bytes, or null for a null-valued header
One immutable Kafka record header.
Unlike Kafka's own header type, this record defensively copies its value bytes
in both directions and implements value-based equals(Object) and
hashCode(), which makes it safe to use in assertions and as map or set
elements.
Example
var traceId = new RecordHeader("trace-id", "abc123".getBytes(UTF_8));
driver.pipeInput("input", 0, key, value, 0L, List.of(traceId));
-
Constructor Summary
ConstructorsConstructorDescriptionRecordHeader(String key, byte[] value) Copies the value so later mutation of the input array cannot change the header. -
Method Summary
Modifier and TypeMethodDescriptionbooleanCompares headers by key and value content.inthashCode()Hashes the key and value content consistently withequals(Object).key()Returns the value of thekeyrecord component.final StringtoString()Returns a string representation of this record class.byte[]value()Returns a copy of the header value.
-
Constructor Details
-
RecordHeader
Copies the value so later mutation of the input array cannot change the header.- Parameters:
key- the header keyvalue- the header value bytes, or null for a null-valued header- Throws:
NullPointerException- ifkeyis null
-
-
Method Details
-
value
public byte[] value()Returns a copy of the header value.- Returns:
- a fresh copy of the value bytes, or null for a null-valued header
-
equals
-
hashCode
public int hashCode()Hashes the key and value content consistently withequals(Object). -
toString
-
key
-