Interface KafkaHeader
@Immutable @DoNotImplement public interface KafkaHeader
Represents the header of a Kafka record, that was either read from or should be written to a Kafka cluster.
The internal state of this interface is completely immutable. All returned ByteBuffer
s are read only and a
deep copy of any byte[]
is made for every method call returning one.
- Since:
- 4.4.0
-
Method Summary
Modifier and Type Method Description @NotNull String
getKey()
@NotNull ByteBuffer
getValue()
byte @NotNull []
getValueAsByteArray()
@NotNull String
getValueAsString()
@NotNull String
getValueAsString(@NotNull Charset charset)
-
Method Details
-
getKey
- Returns:
- the key of this header.
- Since:
- 4.4.0
-
getValue
- Returns:
- the value of this header.
- Since:
- 4.4.0
-
getValueAsByteArray
byte @NotNull [] getValueAsByteArray()- Returns:
- the value of this header.
- Since:
- 4.4.0
-
getValueAsString
- Returns:
- the value of this header as a string.
UTF_8
is used for the decoding. - Since:
- 4.4.0
-
getValueAsString
- Parameters:
charset
- theCharset
that is used for the decoding.- Returns:
- the value of this header as a string.
- Since:
- 4.4.0
-