> gouessej wrote
> Good job. I like the solution "C" because there is no support of capacity
> expressed with a long in the current Java SE API and under Android.
> However, the maximum capacity is Integer.MAX_VALUE, i.e 2 GiB
> <
https://en.wikipedia.org/wiki/Gibibyte>.
>
> Yes it is a misfortunate API decision in java to use signed ints, it limits
> the max capacity of Direct ByteBuffer's to 2GB.
> There has been filed enhancement bugs since 2001 to fix it
>
https://bugs.openjdk.java.net/browse/JDK-4496703 - (bf) Buffer classes limited
> by 32-bit addressing
> but it has been ignored.
>
> While investigating i found that there exist one alternative way to create a
> direct ByteBuffers using the MappedByteBuffer class. MappedByteBuffer is using
> mmap internally thus it should not have any size limitation. Unfortunally the
> implementation of MappedByteBuffer has added a fictive limitation of 2Gb here
> as well.
>
https://bugs.openjdk.java.net/browse/JDK-6347833 - (fs) Enhance
> MappedByteBuffer to support sizes >2GB on 64 bit platforms.