What bytes where

To see exactly what is going into the blob, we can look at the Java source code:
svn://oehive.org/prorefactor/branches/proparsej/org.prorefactor.core

Classes of interest are:
com.joanju.proparse.sockets.BlobBuilder
com.joanju.DataXferStream

The first byte of a record in an Xfer blob is the encoding - a single byte to tell what kind of record it is.

What follows the encoding byte depends on the record type. For example, if we've stored an array or list, we get this:

	out.writeInt(list.size());
	for (Object o : list)
		writeRef(o);

(Excerpted from DataXferStream.java.)

So a list record is the encoding byte, then 4-byte int N to tell us the size of the list, then N 4-byte integers, each of those being an index to another record.

Don't forget that the header gives us offsets which are count-from-zero (Java), and we add 1 to those to get us Progress count-from-one.

So what is the 08 at position 0 and 1A of the blob.bin file, and why you skip over it ?

private static final byte XLIST = 8;

It is the byte encoding for a List record.

Let's look at another record type within the blob: Any Xferable class object. (JPNode is Xferable, as is anything in the blob other than int, boolean, String, List, or Map.)

private void writeXferableRecord(Xferable x) throws IOException {
	out.writeByte(XOBJECT);
	Class clas = x.getClass();
	int classIndex = objectIndexes.getIndex(clas);
	if (classIndex == -1) {
		classIndex = objectIndexes.add(clas);
		classExamples.add(x);
	}
	out.writeInt(classIndex);
	x.writeXferBytes(this);
}

So an Xferable is written with:

  • byte encoding (XOBJECT = 12)
  • 4-byte int index to the class's schema record
  • the fields as written by the Xferable object's class