开发者

inserting data in the middle of a text file through java

I want to insert the data at some positions in the text file without actually overwrit开发者_C百科ing on the existing data.I tried RandomAccessFile ....but that also overwrites it.... Is there any way to insert the data without overwriting?? -Thanks in advance


You have to read your file and rewrite it. During this operation you have to find the place where you want to put your text and write it.


It is not possible (not with Java, and not with any other programming language) to "just" insert data in the middle of the file, without having to re-write the rest of the file. The problem is not the programming language, the problem is the way files work.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜