code: public static MappedBuffer allocate(File file, FileChannel.MapMode mode, int initialCapacity, int maxCapacity) {
      checkNotNull(file, "file cannot be null");
      checkNotNull(mode, "mode cannot be null");
      checkArgument(initialCapacity <= maxCapacity, "initial capacity cannot be greater than maximum capacity");
      return new MappedBuffer(MappedBytes.allocate(file, mode, initialCapacity), 0, initialCapacity, maxCapacity);
    }
docs: Allocates a mapped buffer.
  <p>
  Memory will be mapped by opening and expanding the given {@link File} to the desired {@code count} and mapping the
  file contents into memory via {@link FileChannel#map(FileChannel.MapMode, long, long)}.
  <p>
  The resulting buffer will have a capacity of {@code initialCapacity}. The underlying {@link MappedBytes} will be
  initialized to the next power of {@code 2}. As bytes are written to the buffer, the buffer's capacity will double
  as int as {@code maxCapacity > capacity}.
  
  @param file            The file to map into memory. If the file doesn't exist it will be automatically created.
  @param mode            The mode with which to map the file.
  @param initialCapacity The initial capacity of the buffer.
  @param maxCapacity     The maximum capacity of the buffer.
  @return The mapped buffer.
  @throws NullPointerException     If {@code file} is {@code null}
  @throws IllegalArgumentException If the {@code capacity} or {@code maxCapacity} is greater than
  {@link Integer#MAX_VALUE}.
  @see #allocate(File)
  @see #allocate(File, FileChannel.MapMode)
  @see #allocate(File, int)
  @see #allocate(File, FileChannel.MapMode, int)
  @see #allocate(File, int, int)