public IndexSummaryBuilder maybeAddEntry(DecoratedKey decoratedKey, long indexStart, long indexEnd, long dataEnd)
    {
        if (keysWritten == nextSamplePosition)
        {
            assert entries.length() <= Integer.MAX_VALUE;
            offsets.writeInt((int) entries.length());
            entries.write(decoratedKey.getKey());
            entries.writeLong(indexStart);
            setNextSamplePosition(keysWritten);
        }
        else if (dataEnd != 0 && keysWritten + 1 == nextSamplePosition)
        {
            // this is the last key in this summary interval, so stash it
            ReadableBoundary boundary = new ReadableBoundary(decoratedKey, indexEnd, dataEnd, (int)(offsets.length() / 4), entries.length());
            lastReadableByData.put(dataEnd, boundary);
            lastReadableByIndex.put(indexEnd, boundary);
        }
        keysWritten++;

        return this;
    }
public IndexSummaryBuilder maybeAddEntry ( DecoratedKey decoratedKey , long indexStart , long indexEnd , long dataEnd ) { if ( keysWritten == nextSamplePosition ) { assert entries . length ( ) <= Integer . MAX_VALUE ; offsets . writeInt ( ( int ) entries . length ( ) ) ; entries . write ( decoratedKey . getKey ( ) ) ; entries . writeLong ( indexStart ) ; setNextSamplePosition ( keysWritten ) ; } else if ( dataEnd != 0 && keysWritten + 1 == nextSamplePosition ) { ReadableBoundary boundary = new ReadableBoundary ( decoratedKey , indexEnd , dataEnd , ( int ) ( offsets . length ( ) / 4 ) , entries . length ( ) ) ; lastReadableByData . put ( dataEnd , boundary ) ; lastReadableByIndex . put ( indexEnd , boundary ) ; } keysWritten ++ ; return this ; }
@param decoratedKey the key for this record
@param indexStart the position in the index file this record begins
@param indexEnd the position in the index file we need to be able to read to (exclusive) to read this record
@param dataEnd the position in the data file we need to be able to read to (exclusive) to read this record
a value of 0 indicates we are not tracking readable boundaries