I'm currently serializing and de-serializing bytes...
# serialization
e
I'm currently serializing and de-serializing bytes manually to and from objects for a custom TCP-level protocol. Structures are relatively simple, so I'd guess a custom
kotlinx-serialization
format might make writing new stuff easier on the long run, especially for devs unfamiliar with direct bytes handling. How much work goes into creating a custom format?
@hfhbd mind if I use your CSV one as a starting point to study how it's done? I guess I'll have to switch from
StringFormat
to
BinaryFormat
.
h
Sure, feel free, I just followed the docs, though.
gratitude thank you 1
e
Any issue you found particularly problematic/time consuming while developing it?
h
It really depends on your format and your classes and what you want to support. Basic stuff is easy, especially object orientated formats, the FLF format is some kind a mess due its specification (no delimiters etc.) and the features I need eg sealed classes.
e
I'll give it a go then. Sounds easy enough for simple formats.
Is using
BinaryFormat
or
StringFormat
mandatory? I'd like to accept only a certain interface instead of a random type T.
h
Its not. It is even unstable
e
Perfect, thanks
a
btw this discussion from a few weeks ago about only allowing specific interfaces to be serialized might be relevant https://kotlinlang.slack.com/archives/C7A1U5PTM/p1701249570920719
gratitude thank you 1