Reaching a specific line in a file using RandomAccessFile

后端 未结 4 762
清歌不尽
清歌不尽 2021-01-12 13:31

Is it possible to position cursor to the start of a specific line in a file through RandomAccessFile?

For e.g. I want to change String starting at char 10 till 20 in

4条回答
  •  没有蜡笔的小新
    2021-01-12 14:14

    To use RandomAccessFile you either need to have fixed-length records or have a "dope vector" of offsets to the start of each record (or, eg, every 10th record). These may or may not be appropriate to your problem.

提交回复
热议问题