Are you using NIO or the old IO? --Junilu Lacar NIO for the network (SocketChannel & ServerSocketChannel) and old IO in the database for reading/writing the db.db. I'm thinking about migrating to New IO for everything, not quite sure yet...
Did you create any sub-interfaces for DB? --Junilu Lacar I didn't because I let the DB open itself when the DB instance is created, and thus, I don't need the open() method in the interface.
I am just worried about the null terminated strings in db.db and the offset, and how to determine the reading of records. --Mark Spritzler In my case, the header length (magic number, schema and stuff) takes 74 bytes. The record length 160 bytes. So I determine the offset within the file with the simple formula:
offset = headerLength + (recNum * recordLength)
and that works like a charm...
Concerning the null terminated
string, I truncate them after reading them with something like:
readString = readString.substring(0,readString.indexOf('0'))
which has the effect of discarding all 0-bytes stuffed after the field value to reach the required field length.