Skip to content
Ioannis Charalampidis edited this page Jun 8, 2016 · 3 revisions

⚠️ This format is Architecture-Dependant: This means if you are compiling a binary bundle in little-endian machine it will only work on little-endian machines!


The JBB bundles are organised in 4 different streams, depending on the bit-length of the encoded data:

  • 8-bit Stream [S8]: For Op-Codes, UINT8, INT8
  • 16-bit Stream [S16]: For UINT16 and INT16
  • 32-bit Stream [S32]: For UINT32, INT32 and FLOAT32
  • 64-bit Stream [S64]: For FLOAT64

The master stream is the S8 on which the op-codes that define the structure of the encoded objects is stored. When an op-code argument has a type different than UINT8 or INT8, the appropriate stream will be used:

There are 3 additional higher-level structures in a JBB bundle:

  • Header [HT]: A 32-byte long structure with the meta-data.
  • String Table [ST]: A list of null-terminated strings used for compressing object keys.
  • Signature Table [GT]: A list of string IDs that compose the keys for each plain-object encountered in the structure.
  • Profile IDs [PT]: A list of profile signatures that were used to compile the bundle.

Compact (.jbb) and Sparse (.jbbp) Bundles

Since the streams are cleanly separated it's possible to speed-up the loading time by loading all 4 streams in parallel. In a compact bundle all 4 streams are merged in a single file, while in a sparse bundle each stream is written to a different file.

.jbb (Compact) .jbbp (Sparse)
HT Header
S64 64-Bit Stream
S32 32-Bit Stream
PT Profile IDs
S16 16-Bit Stream
GT Signature Table
S8 8-Bit Stream
ST String Table
*.jbbp *_b16.jbbp *_b32.jbbp *_b64.jbbp
HT Header PT Profile IDs S32 32-Bit Stream S64 64-Bit Stream
S8 8-Bit Stream S16 16-Bit Stream
ST String Table GT Signature Table

Header Structure

Offset +1 +2 +3 +4
0 magic profile_id
4 version profile_count
8 s64_length
12 s32_length
16 s16_length
20 s8_length
24 st_length
28 gt_length

The following fields are in the table:

  • magic : magic number is a 16-bit unsigned integer with value 0x4231, so it's represented as <31h,42h> in machines with little-endian architecture or <42h,31h> in big-endian. It's therefore possible to detect incompatible endianess before loading the bundle.
  • profile_id: If only 1 profile is used in the bundle, this field contains the signature ID of the profile. If more than 1 profile are used, this field should be 0x00.
  • version: The version of the jbb encoder that created this bundle.
  • profile_count: The number of profiles in the bundle.
  • s64_length: The length (in bytes) of the 64-bit stream.
  • s32_length: The length (in bytes) of the 32-bit stream.
  • s16_length: The length (in bytes) of the 16-bit stream.
  • s8_length: The length (in bytes) of the 8-bit stream.
  • st_length: The length (in bytes) of the string table.
  • gt_length: The length (in bytes) of the signature table.