Class MsgPackSerializer

All Implemented Interfaces:
Function<Object,byte[]>, ThrowingFunction<Object,byte[]>, MsgPackMetaProvider, ArrayRecordWritable, RecordWritable, TokenWritable
Direct Known Subclasses:
MsgPackSerializer.Base64, MsgPackSerializer.SpacedHex

Serializes POJO models to MessagePack.
Media types:
Handles Accept types: application/msgpack, octal/msgpack

Produces Content-Type types: application/msgpack

The legacy media type octal/msgpack is retained in the Accept list as a backward-compatibility alias. The Content-Type emitted by the serializer is always the RFC-standard application/msgpack value.

Description

Java-to-MessagePack type mapping:

  • Maps and beans → MessagePack map type
  • Collections and arrays → MessagePack array type
  • String / Enum → MessagePack string type
  • Boolean → MessagePack boolean type
  • Number (int, long, float, double, etc.) → MessagePack number type (variable-length int or float)
  • Date / Calendar / Instant → ISO 8601 string
  • Duration → ISO 8601 duration string
  • byte[] → MessagePack binary type
  • null → MessagePack nil type
  • All other types → fallback to toString() as string
Notes:
  • This class is thread safe and reusable.
See Also: