Class LongDeltaSerializer
java.lang.Object
com.esotericsoftware.kryo.kryo5.Serializer<Long>
ch.qos.logback.classic.kryo.LongDeltaSerializer
Serializer for
long values that stores successive values as deltas.
Each written value is encoded as current - lastWritten via
Output.writeVarLong(long, boolean) (zig-zag). On read, the absolute
value is reconstructed by adding the delta to the last reconstructed value.
Write and read state are independent so the same instance can be used for
both directions without interference.
Typical for monotonically increasing timestamps in a log stream, where deltas are small and varint-encode well.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionread(com.esotericsoftware.kryo.kryo5.Kryo kryo, com.esotericsoftware.kryo.kryo5.io.Input input, Class<? extends Long> type) longreadLong(com.esotericsoftware.kryo.kryo5.io.Input input) Inverse ofwriteLong(Output, long).voidwrite(com.esotericsoftware.kryo.kryo5.Kryo kryo, com.esotericsoftware.kryo.kryo5.io.Output output, Long value) voidwriteLong(com.esotericsoftware.kryo.kryo5.io.Output output, long value) Writesvalueas a zig-zag varint delta from the previous write.Methods inherited from class com.esotericsoftware.kryo.kryo5.Serializer
copy, getAcceptsNull, isImmutable, setAcceptsNull, setImmutable
-
Constructor Details
-
LongDeltaSerializer
public LongDeltaSerializer()
-
-
Method Details
-
writeLong
Writesvalueas a zig-zag varint delta from the previous write. -
readLong
Inverse ofwriteLong(Output, long). -
write
-
read
-