I am really in trouble: I want to read HUGE files over several GB using FileChannel
s and MappedByteBuffer
s - all the documentation I found implies it's rather simple to map a file using the FileChannel.map()
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?
In reality, I get lots of problems regarding OutOfMemoryException
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 MappedByteBuffer
s without just getting exceptions?
Can I ask the system which portion of a file I can safely map before I try FileChannel.map()
? How?
Why is there so little documentation about this feature??
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…