// try to merge two gaps if one gap has been processed already and the position of the next record is known
// if the next record is also a gap, merge these gaps and go on recursively
// first check if next gap position is outside of file size
longnextRecord=thisGap.seek+thisGap.size+4;
if(nextRecord>=this.file.length())return;// end of recursion
// move to next position and read record size
this.file.seek(nextRecord);
intlen=file.readInt();
// check if the record is a gap-record
assertlen>0;
if(len==0){
// a strange gap record: we can extend the thisGap with four bytes
}else{
intt=this.file.read();
if(t==0){
System.out.println("*** DEBUG-BLOBHeap "+heapFile.getName()+": merging gap from pos "+thisGap.seek+", len "+thisGap.size+" with next record of size "+len+" (+ 4)");
// the nextRecord is a gap record; we remove that from the free list because it will be joined with the current gap
gapg=removeFromFree(nextRecord,len);
assertg!=null;
// remove also the current gap, we will write a new gap entry