Package codes.grow.packages.betterstack
Class MessagePack
java.lang.Object
codes.grow.packages.betterstack.MessagePack
Minimal MessagePack encoder for Better Stack ingest bodies (no dependency).
Instant
values become timestamp extensions (type -1, nanosecond precision), byte[] becomes
bin; maps, collections, arrays, strings, booleans, integers, floats and null map to
their MessagePack types. Any other object is written as its toString() text.-
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]arrayHeader(int n) Writes the header of an array ofnelements (the elements follow).static byte[]Encodes a value.
-
Method Details
-
encode
Encodes a value.- Parameters:
value- value- Returns:
- MessagePack bytes
- Throws:
ValidationException- when the value is nested deeper than 100 levels or an integer does not fit 64 bits
-
arrayHeader
public static byte[] arrayHeader(int n) Writes the header of an array ofnelements (the elements follow).- Parameters:
n- element count- Returns:
- header bytes
-