Skip to content
This repository was archived by the owner on Feb 28, 2021. It is now read-only.

Encoding

Přemysl Šťastný edited this page Aug 29, 2018 · 18 revisions

Stream convention

This is the convention about writing primitive type to stream. Protocol and blob messages always use it. There are some situations in program, when other convensions are used, but they will be explicitally signed in documentation. The convention uses always little endian.

All basic trasmission functions are implemented in Premy.Chatovatko.Libs.DataTransmission.

Write int

int written in little endian order into stream.

Write byte[]

First of all, the number of bytes to receive is sended (int) and after it bytes itself.

Write string

All strings are encoded to UTF-8 and then send as byte[].

Write class as Json

All Json serializations are made by Json.NET. See their documentation for details.

After serialization is done, the result is sended as string.

Documentation convention

Json documentation convention

{} means an json object. {String theName, String theSecondName = "blabla"} means an object contain string named "theName" and string named "theSecondName". "theSecondName" must be "blabla". Analogically the same Boolean and Number.

Array theName [{Number a}] means, that theName is an array of {Number a} objects.

String?/Array?/... theName means, that theName is optional.

DateTimes are written in ISO 8601 convention. byte[] are saved as base64 strings.