}
private int writeKey(Writable w) throws BaseException, IOException
{
DataOStream dos = Streams.dos.get();
ByteArrayOS bos = dos.getUnderlyingStream();
bos.reset();
w.write(dos);
ensureCapacity(bos.len(), true);
int i = currentSize * 2;
System.arraycopy(bos.bytearray(), 0, bytes, bytesUsed, bos.len());
keyOffsetsArray[i] = bytesUsed;
keyOffsetsArray[i+1] = bos.len();
int[] posRet = position(new EntryPosition(currentSize));
int pos = posRet[1];
if ( posRet[0] == 0 )
{
rearrange(keyOffsetsArray, pos);
rearrange(valueOffsetsArray, pos);
currentSize += 1;
bytesUsed += bos.len();
lastModified = System.nanoTime();
}
return pos;
}