public final long appendRecord ( T record ) throws IOException { long pointer = this . writeView . getCurrentPointer ( ) ; try { this . serializer . serialize ( record , this . writeView ) ; this . recordCounter ++ ; return pointer ; } catch ( EOFException e ) { // we ran out of pages. // first, reset the pages and then we need to trigger a compaction //int oldCurrentBuffer = this . writeView . resetTo ( pointer ) ; //for (int bufNum = this.partitionPages.size() - 1; bufNum > oldCurrentBuffer; bufNum--) { // this.availableMemory.addMemorySegment(this.partitionPages.remove(bufNum)); //} throw e ; } }
Inserts the given object into the current buffer . This method returns a pointer that can be used to address the written record in this partition .