This project is read-only.

Quick Reference

Main features

Reader - fast reader and deserializer. Support the standard primitive and reference types, dynamic object.
Writer - fast writer and serializer. Can handle primitive, standard, reference types and the user defined types.
Manual reading and writing.
Streaming and networking purposes are supported.
Objects, arrays and other containers with unknown length are supported.
Automatically switching between Big-Endian and Little-Endian modes. Big-Endian by design of the specification. Means that on Big-Endian or Little-Endian machines your data will be correctly read according to the machine endianness.
UTF-8 is main encoding.
Efficient space usage.

Supported types in read/write modes

null - nothing.
bool (true and false) - logical.
byte - 8 bit unsigned integer number.
short - 16 bit integer number.
int - 32 bit integer number.
long - 64 bit integer number.
BigInteger - huge integer number.
float - 32 bit single-precision float-point number.
double - 64 bit double-precision float-point number.
decimal - 128 bit number.
string - immutable string.
array, IList - container.
IDictionary<string, object> - dynamic/ExpandoObject.
IDictionary - dictionary.
Object with Key/Value pairs (public fields or properties) - dictionary or dynamic object when deserializing.
All other objects of unknown reference types handled as previous.

CLS Compliant

Assembly can be used by all languages that support .NET Framework.


Mono friendly. All functions, names, types from this project are supported by Mono.



using System;
using System.Dynamic;
using System.IO;

using M1xA.Core.IO.Ubjson;
using M1xA.Core.IO.Ubjson.Extensions;

namespace UbjsonNetExample
    class Program
        static void Main(string[] args)
            Random r = new Random(DateTime.Now.Millisecond);

            dynamic obj = new ExpandoObject();

            obj.Id = r.Next(int.MaxValue);
            obj.Message = "All OK!";
            obj.Act = new Action(() => { }); // Skipped

            FileStream fs = new FileStream("fs.ubj", FileMode.Create);

            using (UbjsonWriter writer = new UbjsonWriter(fs))

            fs.Seek(0, SeekOrigin.Begin);

            UbjsonReader reader = new UbjsonReader(fs);

            dynamic clone = reader.Parse().AsDynamic();

            Console.WriteLine("Id={0}; Message={1}.", clone.Id, clone.Message);


Id=1024581424; Message=All OK!.

Last edited Oct 21, 2011 at 4:54 PM by M1xA, version 9


No comments yet.