7

Having to work with large files now, I would like to know when the java libraries will start switching to long for indexing in their methods.

From Inputstreams read(byte[] b, int off, int len) - funnily there is long skip(long) also - to MappedByteBuffer to the basic indexing of arrays and lists, everything is adressed as int.

Is there an official plan for enhancment of the libraries?

Do initiatives exist to pressure oracle into enhancing the libraries, if there is no official plan yet?

Ozair Kafray
  • 840
  • 1
  • 8
  • 15
Ido Tamir
  • 181
  • 4

2 Answers2

11

p42 of slides at Simon Ritter's PDF To Java SE 8, and Beyond! - QCon London indicates that it is scheduled for Java 9.

Incidentally, the keyword you were lacking to find this yourself with Google in 10 seconds is JSR.

Peter Taylor
  • 4,012
  • 1
  • 24
  • 29
4

files can already be addressed by longs and having a byte buffer of over 2 GigaByte is a waste and will lead to a OutOfMemoryException very fast on 32 bit machines (use multiple byte buffers if you need to have that big of a range)

also the FileChannel.map takes longs to specifiy the offset and size allowing you to map passed the 2GB mark

also RandomAccessFile uses a long for the seek index

ratchet freak
  • 25,706
  • 2
  • 62
  • 97
  • 2
    Why would it be wasteful to have a byte buffer over 2Gb? I have the same need myself. I have 16Gb on my development laptop and 128Gb on my largest server. The "multiple ByteBuffer" workaround is inefficient. – Tim Cooper Apr 12 '14 at 00:57