if (position + size > size()) {
fileSystem.truncate(handle, position + size);
}
long alignment = position - position % ALLOC_GRANULARITY;
int offset = (int) (position - alignment);
PlatformAddress address = PlatformAddressFactory.allocMap(handle,
alignment, size + offset, mapMode);
MappedByteBuffer buffer = null;
try {
buffer = MappedByteBufferFactory.getBuffer(address, mapMode, size,
offset);