reading buffered binary file (with seek)

后端 未结 2 1136
抹茶落季
抹茶落季 2021-01-03 16:22

Say I need to read huge binary file of integers, a handy way is:

FileInputStream fi = new FileInputStream(file);
BufferedInputStream bi = new BufferedInput         


        
相关标签:
2条回答
  • 2021-01-03 16:39

    Have a look at NIO. For example, java.nio.MappedByteBuffer.

    0 讨论(0)
  • 2021-01-03 16:48

    Just start with fi.skip(position) before wrapping it with bi and di. The underlying stream actually makes a call to seek when position is sufficiently large.

    0 讨论(0)
提交回复
热议问题