mp_bintools/docs/bipack.md

19 lines
1.1 KiB
Markdown
Raw Normal View History

2023-03-16 01:03:45 +03:00
# Module mp_bintools
2023-03-15 13:21:59 +03:00
2023-03-16 01:03:45 +03:00
This library contains a `Bipack` binary format serializer, see [net.sergeych.bipack.BipackEncoder] and [net.sergeych.bipack.BipackDecoder]. Also, there are many general-purpose utilities that simplify binary data processing, see package [net.sergeych.bintools] below.
2023-03-15 13:21:59 +03:00
2023-03-16 01:03:45 +03:00
# Package net.sergeych.bipack
2023-03-15 13:21:59 +03:00
2023-03-16 01:03:45 +03:00
Bipack ais a common kotlinx serializer that works pretty much like any other `kotlinx.serialization` format. You just mark your class as `@Serializable` and it does the rest.
2023-03-15 13:21:59 +03:00
2023-03-16 01:03:45 +03:00
- [BipackEncoder] to serializes anything to bipack format.
- [BpackDecoder] deserializes from bipack back.
2023-03-15 13:21:59 +03:00
2023-03-16 01:03:45 +03:00
There are also special annotation to fine tune the format: [Extendable], [Framed], [CrcProtected] for classes and [Unsigned] for integer data fields.
2023-03-15 13:21:59 +03:00
2023-03-16 01:03:45 +03:00
# Package net.sergeych.bintools
2023-03-15 13:21:59 +03:00
2023-03-16 01:03:45 +03:00
General-purpose binary tools: encoding to bytes, hex, binary dumps. variable length integer, ect. Most of it is used internally by bipack serializers, see [net.sergeych.bipack] for details.
2023-03-15 13:21:59 +03:00
2023-03-16 01:03:45 +03:00
In particular, see [Varint] and [Smartint] variable-length compact integer codecs and also [DataSource] and [DataSink] multiplatform synchronous read/write interfaces.