From 05edc7c8dddf10274e5d10d3705c476627d6c063 Mon Sep 17 00:00:00 2001 From: akwizgran Date: Wed, 1 Apr 2015 11:27:55 +0000 Subject: [PATCH] akwizgran created page: BDF --- BDF.markdown | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 BDF.markdown diff --git a/BDF.markdown b/BDF.markdown new file mode 100644 index 0000000..9a27722 --- /dev/null +++ b/BDF.markdown @@ -0,0 +1,15 @@ +BDF is a data format designed for simplicity and compactness. It is a schema-less format with six primitive types (null, boolean, integer, floating point, string, raw) and two container types (list, dictionary). + +Each object consists of a type, length and value. The value may be empty. The first four bits of the object give its type. Depending on the type, the next four bits either give the length of the value, or the number of subsequent bytes that contain the length of the value. + +* **0: Null** - Length is 0, value is empty. +* **1: Boolean** - Length is 1, value is 0 or 1. +* **2: Integer** - Length is 0, 1, 2, 4 or 8. Value is an integer with the specified length in bytes. +* **3: Floating point** - Length is 4 or 8. Value is a floating point number with the specified length in bytes. +* **4: String** - Length is 0, 1, 2 or 4. Value is an integer with the specified length in bytes, followed by a string with its length in bytes given by the integer. +* **5: Raw** - Length is 0, 1, 2 or 4. Value is an integer with the specified length in bytes, followed by raw binary data with its length in bytes given by the integer. +* **6: List** - Length is 0. The value consists of zero or more objects of any type followed by an end object. +* **7: Dictionary** - Length is 0. The value consists of zero or more key-value pairs followed by an end object. The keys must be strings and the values may be of any type. +* **8: End** - Length is 0, value is empty. Marks the end of a list or dictionary. + +All integers in BDF are big-endian two's complement, floating point numbers are IEEE 754, and strings are UTF-8.