The Echo binary format is the primary serialization target for production use in Prowl.Echo. It preserves everyDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/ProwlEngine/Prowl.Echo/llms.txt
Use this file to discover all available pages before exploring further.
EchoType value exactly during round-trips, produces compact output, and offers two distinct encoding modes so you can choose between maximum throughput and minimum file size.
Encoding modes
EchoBinaryFormat supports two modes, controlled by BinarySerializationOptions.EncodingMode:
Performance mode
Integers are written at their natural fixed width (1, 2, 4, or 8 bytes). Read and write operations are as fast as possible because no variable-length decoding is needed. Files are larger, but access times are minimized. This is the default mode.
Size mode
Integers are encoded using LEB128 (Little Endian Base 128), a variable-length encoding that uses fewer bytes for small values. String keys in compound tags are additionally compressed with LZW (Lempel-Ziv-Welch). Files are smaller, but encoding and decoding carry a small additional cost.
BinarySerializationOptions
Pass aBinarySerializationOptions instance to any write or read method to control the encoding mode. If you omit the options argument, BinaryEncodingMode.Performance is used.
Writing binary data
To a file
Use theEchoObject.WriteToBinary(FileInfo, BinarySerializationOptions?) overload to write directly to disk:
To a stream via BinaryWriter
Use theEchoObject.WriteToBinary(BinaryWriter, BinarySerializationOptions?) overload to write into any stream, such as a network socket or a memory buffer:
Via IFileFormat extension methods
TheEchoBinaryFormat.Instance singleton exposes the full IFileFormat extension API. This is useful when you want to work with byte[] buffers directly without managing BinaryWriter yourself:
Reading binary data
From a file
From a stream via BinaryReader
Via IFileFormat extension methods
Complete round-trip example
LEB128 and LZW compression internals
This section describes implementation details. You do not need to interact with these directly —
BinarySerializationOptions handles everything.short, int, long, ushort, uint, ulong) are encoded using LEB128 (Little Endian Base 128):
- ULEB128 is used for unsigned types. Each byte carries 7 bits of data; the high bit signals that more bytes follow.
- SLEB128 is used for signed types, with sign extension applied to the final byte.
0–127) compress to a single byte; larger values expand as needed, up to the type’s natural maximum width.
In Size mode, string keys inside Compound tags are additionally compressed with LZW (Lempel-Ziv-Welch). LZW builds a shared dictionary during the encode pass (up to 4,096 entries), replacing repeated character sequences with short integer codes. This is particularly effective for structures with many repeated field names such as serialized component arrays.
Float, double, and decimal values are always stored at their natural fixed width in both modes, since variable-length encoding provides no benefit for floating-point data.
Using EchoBinaryFormat.Instance directly
The singleton carries its ownOptions property, which lets you configure the format once and reuse it: