将一个文件的内容顺序反过来写,不许用第三个文件,怎么做?

xjz97 2003-10-15 10:35:49
这里文件是比申请的临时存放数组大的。
请问应该用什么函数可以从文件的中间一点开始读文件?
...全文
78 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
happyegg 2003-10-15
  • 打赏
  • 举报
回复
用BufferedInputStream或者随便一种文件读取类行,从后往前读,然后把读取的byte倒
过来写到第二个文件。
如果你是连第二个文件都不准用的话,那要把你的文件全部读入内存才行了。
liad 2003-10-15
  • 打赏
  • 举报
回复
java.io.RandomAccessFile

long length()
Returns the length of this file. void seek(long pos)

void seek(long pos)
Sets the file-pointer offset, measured from the beginning of this file, at which the next read or write occurs.

62,612

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧