Reading a file larger than 2GB into memory in Java

后端 未结 4 1367
南方客
南方客 2021-01-12 08:54

Since ByteArrayInputStream is limited to 2GB, is there any alternate solution that allows me to store the whole contents of a 2.3GB (and possibly larger) file i

4条回答
  •  梦毁少年i
    2021-01-12 09:23

    If you have huge quantities of memory, you really won't get any performance improvement anyway. It's only getting read in once either way, and the disk cache will ensure it gets done optimally. Just use a disk-based input stream.

提交回复
热议问题