title: Java NIO MappedByteBuffer OutOfMemoryException
body: <p>I am really in trouble: I want to read HUGE files over several GB using <code>FileChannel</code>s and <code>MappedByteBuffer</code>s - all the documentation I found implies it's rather simple to map a file using the <code>FileChannel.map()</code> method.
  Of course there is a limit at 2GB as all the Buffer methods use int for position, limit and capacity - but what about the system implied limits below that?</p>
  
  <p>In reality, I get lots of problems regarding <code>OutOfMemoryException</code>s! And no documentation at all that really defines the limits!
  So - how can I map a file that fits into the int-limit safely into one or several <code>MappedByteBuffer</code>s without just getting exceptions?</p>
  
  <p>Can I ask the system which portion of a file I can safely map before I try <code>FileChannel.map()</code>? How?
  Why is there so little documentation about this feature??</p>