RandomAccessFile 文本随机读写

简介: java.io.RandomAccessFile 随机读写文件的类。 long java.io.RandomAccessFile.length() throws IOException 返回文件的大小,单位字节。 Returns the length of this file. int java.io.RandomAccessFile.skipBytes(int n) throw
java.io. RandomAccessFile
随机读写文件的类。
long java.io.RandomAccessFile. length() throws IOException
返回文件的大小,单位字节。
Returns the length of this file.
int java.io.RandomAccessFile. skipBytes(int n) throws IOException
读游标向后移动n字节。
Attempts to skip over n bytes of input discarding the skipped bytes. 
void java.io.RandomAccessFile. seek(long pos) throws IOException
设置文件游标相对于文件开头的偏移量。
Sets the file-pointer offset, measured from the beginning of this file, at which the next read or write occurs. 
long java.io.RandomAccessFile. getFilePointer() throws IOException
返回当前游标的偏移量。
Returns the current offset in this file.
String java.io.RandomAccessFile. readLine() throws IOException
从当前位置读一行,返回String。
Reads the next line of text from this file
目录
相关文章
|
4月前
|
存储 API Python
随机读写
随机读写
31 0
|
4月前
|
存储 文件存储
<文件操作> 文件的打开与关闭,顺序读写,随机读写,二进制文件,读取结束的判定,文件缓冲区
<文件操作> 文件的打开与关闭,顺序读写,随机读写,二进制文件,读取结束的判定,文件缓冲区
35 1
|
4月前
|
C语言
随机读写数据文字
随机读写数据文字
24 1
随机读写数据文字
|
4月前
|
存储 C语言
用二进制方式向文本读写数据
用二进制方式向文本读写数据
28 3
|
9月前
|
C++
C++文件的随机读写与特定格式输入输出
C++文件的随机读写与特定格式输入输出
56 0
|
9月前
|
XML C# 数据格式
C#读取写入文件的三种方式
最近对文件的操作比较频繁。这里记录一下常用的几种文件读写的方式。 我这里使用窗体来做测试,例子在文末,可下载。
79 0
|
存储 移动开发 Java
JavaNIO实现按行读取文件操作
在Java编程中,文件操作常常是必不可少的步骤。在对文件进行操作时,按行读取文件是一个常见需求。Java提供了多种方法实现按行读取文件,其中一种方法是使用JavaNIO。
181 0
从文件1中读取数据,修改数据的内容,然后存入文件2中,再从文件2中把数据读取出来显示在屏幕上
从文件1中读取数据,修改数据的内容,然后存入文件2中,再从文件2中把数据读取出来显示在屏幕上
136 0
【文件随机读写和文件缓冲区】
1.1fseek函数 根据文件指针的位置和偏移量来定位文件指针。 看不懂没关系,举个例子你就明白了。 我们首先在text.txt文件中放入 “abcdef” 这些字符。