title: Memory-mapping huge files in Java
body: <p>Is it possible to memory-map huge files (multiple GBs) in Java?</p>
  
  <p>This method of <code>FileChannel</code> looks promising:</p>
  
  <pre><code>MappedByteBuffer map(FileChannel.MapMode mode, long position, long size)
  </code></pre>
  
  <p>Both <code>position</code> and <code>size</code> allow for 64-bit values -- so far, so good.</p>
  
  <p><code>MappedByteBuffer</code>, however, only provides methods for 32-bit positions (<code>get(int index)</code>, <code>position(int newPosition)</code>, etc.), which seems to imply that I cannot map files larger than 2 GB.</p>
  
  <p>How can I get around this limitation?</p>