Java RandomAccessFile vs. DataInputStream for byte operations

后端 未结 2 1214
你的背包
你的背包 2020-12-21 13:54

I need to read bytes from a file.
Is there a difference (e.g. efficiency, memory, runtime, complexity and inelegance of code) between using RandomAccessFile

2条回答
  •  没有蜡笔的小新
    2020-12-21 14:39

    If you are only doing sequential access, by themselves they are essentially equivalent; however a DataInputStream around a BufferedInputStream around a FileInputStream will be considerably more efficient than a RandomAccessFile.

提交回复
热议问题