Java: fastest way to do random reads on huge disk file(s)

前端 未结 4 663
走了就别回头了
走了就别回头了 2021-02-04 19:12

I\'ve got a moderately big set of data, about 800 MB or so, that is basically some big precomputed table that I need to speed some computation by several orders of magnitude (cr

4条回答
  •  我在风中等你
    2021-02-04 19:40

    RandomAccessFile (blocking) may help: http://java.sun.com/javase/6/docs/api/java/io/RandomAccessFile.html

    You can also use FileChannel.map() to map a region of file to memory, then read the MappedByteBuffer.

    See also: http://java.sun.com/docs/books/tutorial/essential/io/rafs.html

提交回复
热议问题