Thread: KFX Format
View Single Post
Old 08-14-2015, 04:50 PM   #24
jhowell
Grand Sorcerer
jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.
 
jhowell's Avatar
 
Posts: 7,105
Karma: 92190133
Join Date: Nov 2011
Location: Charlottesville, VA
Device: Kindles
The kfx binary object encoding makes use of forward encoded variable-width integers as described in the MobileRead Wiki.

Values are represented by a type byte, followed by data. The four most significant bits of the type byte indicate the specific type and the four least significant bits indicate the length of the data that follows. A special value of 14 for the length indicates that a variable-width integer follows the type byte and it indicates the true length of the data.

Type values that I have detected are: 2 for integer (stored big-endian), 8 for string, 10 for binary data, 11 for a list (contains other types), 13 for a dictionary (set of id/value pairs), and 14 for an object (id/data pair). Other type values are used, but I haven't found enough examples to be able to determine what they represent.

Object and attribute ids use variable-width integers. The mapping to their actual names is not encoded in the data.

Last edited by jhowell; 08-14-2015 at 04:51 PM. Reason: typo
jhowell is offline   Reply With Quote