For debugging, learning and teaching purposes, the db4o file format can be modified to be (nearly ?) human readable.
To do this, simply compile the sources with Deploy.debug set to true, run an application that creates a db4o database file and look at the file with any editor.
With the Deploy.debug setting all pointers in the database file will be readable with their physical address as a readable number.
All other slots will be identifiable by a single character at the beginning. An index that explains the character constants can be found in com.db4o.internal.Const4.
To understand the format best, you may want to look at the File Header structure and at the #readThis() methods of classes derived from PersistentBase, like ClassMetadataRepository for instance.
This functionality proved to be very useful when db4o was originally written. By marking freespace with XXXXes a bug in the format could be spotted immediately by visual inspection of a database file.
To navigate through a database file in your favourite editor, it will work best if you write a macro for this editor that allows you to mark and select a number in the database file and to hit a button in the editor to jump to the corresponding offset in the database file (number of characters from the beginning).
Such macro for Microsoft Word is presented below:
OffsetNavigator.Vb Sub SearchOffset() Dim pos As Integer pos = Val(Selection.Text) If pos = 0 Then MsgBox ("The selection is not a number") Else ActiveDocument.Content.Characters(pos).Select End If End Sub
To make use of it, open Visual Basic Macro editor within your Word environment, create a new Macro in the Normal template and paste the code above. In order to make its usage easy assign a key sequence to call the macro command:
Now you can navigate through the human-readable db4o file using the selected key sequence.