public byte[] dump()
{
ArrayList allbytes = new ArrayList();
int byteCount = 0;
for (int index=0; index<this.keys.Count; index++)
{
string thisKey = (string) this.keys[index];
byte[] thisValue = (byte[]) this.values[index];
byte[] keyprefix = new byte[BufferFile.INTSTORAGE];
byte[] keybytes = BplusTree.StringToBytes(thisKey);
BufferFile.Store(keybytes.Length, keyprefix, 0);
allbytes.Add(keyprefix);
allbytes.Add(keybytes);
byte[] valueprefix = new byte[BufferFile.INTSTORAGE];
BufferFile.Store(thisValue.Length, valueprefix, 0);
allbytes.Add(valueprefix);
allbytes.Add(thisValue);
}
foreach (object thing in allbytes)
{
byte[] thebytes = (byte[]) thing;
byteCount+= thebytes.Length;
}
int outindex=0;
byte[] result = new byte[byteCount];
foreach (object thing in allbytes)
{
byte[] thebytes = (byte[]) thing;
int thelength = thebytes.Length;
Array.Copy(thebytes, 0, result, outindex, thelength);
outindex+= thelength;
}
if (outindex!=byteCount)
{
throw new BplusTreeException("error counting bytes in dump "+outindex+"!="+byteCount);
}
return result;
}