[sword-devel] To DM and Troy: Questions about making a module , an extract byte

ZJ Li lzj369 at gmail.com
Fri Aug 24 10:32:27 MST 2007

DM ,

I notice that for genbook, we have the following code to read dat file:

 byte[] buffer = SwordUtil.readRAF(datRaf, offset, 12);
       node.setParent(SwordUtil.decodeLittleEndian32(buffer, 0));
       node.setNextSibling(SwordUtil.decodeLittleEndian32(buffer, 4));
       node.setFirstChild(SwordUtil.decodeLittleEndian32(buffer, 8));

       buffer = SwordUtil.readUntilRAF(datRaf, (byte) 0);
       int size = buffer.length;
       if (buffer[size - 1] == 0)

       Key key = new DefaultKeyList(null, bmd.getName());
       // Some of the keys have extraneous whitespace, so remove it.
       node.setName(SwordUtil.decode(key, buffer, size,

       buffer = SwordUtil.readNextRAF(datRaf, 2);

at this line:
  buffer = SwordUtil.readUntilRAF(datRaf, (byte) 0);

we look for the byte 0 for stop position. so we can get the node name
from data file.

My question is did we originally put this extract byte after the name?

Troy, can you confirm this?

View this message in context: http://www.nabble.com/To-DM-and-Troy%3A-Questions-about-making-a-module-%2C-an-extract-byte-tf4324550.html#a12315791
Sent from the SWORD Dev mailing list archive at Nabble.com.

More information about the sword-devel mailing list