Class FieldByteAccumulator
java.lang.Object
ch.qos.logback.classic.kryo.FieldByteAccumulator
Accumulates bytes written to an
Output or read from an Input, keyed by field name.
Write accounting uses Output.position() (suitable for a fixed buffer with no flush).
Read accounting uses Input.total() so deltas remain correct across buffer refills.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddump()Dumps all accumulated field byte counts and the total toSystem.out.voiddump(PrintStream out) Dumps all accumulated field byte counts and the total toout.voidmerge(FieldByteAccumulator other) Addsother's field totals into this instance.<T> Tread(com.esotericsoftware.kryo.kryo5.io.Input input, String field, FieldByteAccumulator.InputAction<T> readAction) RunsreadActionand adds the number of bytes read tofield.longreadLong(com.esotericsoftware.kryo.kryo5.io.Input input, String field, LongSupplier readAction) Likeread(Input, String, InputAction)but for a primitivelong, so the result is not boxed.voidreset()snapshot()Unmodifiable view of cumulative bytes per field.toString()longtotal()intRunswriteActionand adds the number of bytes written tofield.
-
Constructor Details
-
FieldByteAccumulator
public FieldByteAccumulator()
-
-
Method Details
-
write
-
read
public <T> T read(com.esotericsoftware.kryo.kryo5.io.Input input, String field, FieldByteAccumulator.InputAction<T> readAction) RunsreadActionand adds the number of bytes read tofield.- Returns:
- the value produced by
readAction
-
readLong
public long readLong(com.esotericsoftware.kryo.kryo5.io.Input input, String field, LongSupplier readAction) Likeread(Input, String, InputAction)but for a primitivelong, so the result is not boxed. -
snapshot
-
total
-
reset
-
merge
Addsother's field totals into this instance. Used when Kryo is rebuilt on a CLOSE/HEADER so accounting survives a codec-epoch reset. -
dump
Dumps all accumulated field byte counts and the total toSystem.out. -
dump
Dumps all accumulated field byte counts and the total toout. -
toString
-