Gospel Library Compact Binary Format

The Gospel Library Compact Binary Format is a flexible and resuable format, designed to express the document hierarchy and content of the scriptures as compactly as possible.


The Gospel Library Compact Binary Format is a binary data format designed as part of the Gospel Library for JavaME project. The format is however open and designed to be flexible and reusable, meaning if it proves useful for any other project it can be reused as needed. The Gospel Library Compact Binary Format is designed to express the document hierarchy and content of the scriptures in as compact a data representation as possible. The format is optimised to have the data represented in a way which can be most efficiently handled by the Gospel Library for JavaME application. The Gospel Library for JavaME application works differently from many of the other mobile Gospel Library applications in that it does not involve rendering any HTML and instead renders style using lower level drawing operations.

Style is represented in terms of a style type, optional style value (depending on the style type) and character offsets and region lengths to represent the characters to which the style applies. Styles can also be applied at a block level such as a paragraph.

Much as the format has been designed for the Gospel Library it has been also designed to be flexible enough to represent many different types of documents of materials in the hopes that the JavaME Gospel Library Application may also be used to display publication other than just the Scriptures.

Data header section

The header section of the compact binary format contains basic information about the document data which is stored in the binary format. This includes mode flags to control such things as byte order (Big Endian or Little Endian) and specify compression used.

The format can be used in compact and non compact mode which is one of the flags in the data mode flags. In compact mode, the format will use more compact data types to represent character offsets and child indices etc. This puts tighter constraints on things like the maximum length of text and the maximum number of children an item can have. The constraints of compact mode are able to properly work with the Standard Works but other publications might potentially not be able to fit within the limitations imposed.

With this in mind the non compact mode is somewhat simpler and supports larger numbers of children and text lengths such that these should not form any real practical limitation. The downside of non compact mode is that it requires a larger amount of space either for storage or transmission.

The header of the Gospel Library Compact Binary Format is as follows:

Gospel Library Compact Binary Format Header
Byte(s) Item Description Values
1 to 4 Data Type Identifier Four bytes which identify the binary data as Compact Gospel Library Binary Format Byte values 3, 7, 12 and 70
This page was last modified on 22 June 2010, at 10:05.

Note: Content found in this wiki may not always reflect official Church information.