简体   繁体   English

Java:fseek(),ftell()等价于文本文件输入?

[英]Java: fseek(), ftell() equivalents for text file input?

How can I seek into a text file in Java? 如何查找Java中的文本文件? I'm processing a text-based journal file, and would like to checkpoint my work so that it can be resumed by a future invocation of my program. 我正在处理一个基于文本的日记文件,并希望检查我的工作,以便以后调用程序时可以恢复它。

I'm looking for something similar to C stdio fseek()/ftell() functionality. 我正在寻找类似于C stdio fseek()/ ftell()功能的东西。

RandomAccessFile gives you random access to a file (surprise, surprise :)) and its readLine() method allows you to process it line by line. RandomAccessFile使您可以随机访问文件(惊奇,惊喜:)),其readLine()方法允许您逐行处理该文件。

The current position can be queried by getFilePointer() and the seek() method seeks. 可以通过getFilePointer()seek()方法进行seek()来查询当前位置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM