code: public static MappedByteBuffer map(File file, MapMode mode, long offset, long len) throws UncheckedIOException {
          N.checkArgNotNull(file);
          N.checkArgNotNull(mode);
  
          RandomAccessFile raf = null;
  
          try {
              raf = new RandomAccessFile(file, mode == MapMode.READ_ONLY ? "r" : "rw");
              return raf.getChannel().map(mode, offset, len);
          } catch (IOException e) {
              throw new UncheckedIOException(e);
          } finally {
              IOUtil.closeQuietly(raf);
          }
      }
docs: Note: copied from Google Guava under Apache License v2.
  
  Maps a file in to memory as per
  {@link FileChannel#map(java.nio.channels.FileChannel.MapMode, long, long)}
  using the requested {@link MapMode}.
  
  <p>Files are mapped from offset 0 to {@code size}.
  
  <p>If the mode is {@link MapMode#READ_WRITE} and the file does not exist,
  it will be created with the requested {@code size}. Thus this method is
  useful for creating memory mapped files which do not yet exist.
  
  <p>This only works for files <= {@link Integer#MAX_VALUE} bytes.
  
  @param file the file to map
  @param mode the mode to use when mapping {@code file}
  @param offset
  @param len
  @return a buffer reflecting {@code file}
  
  @see FileChannel#map(MapMode, long, long)
  @since 2.0