Skip to content

Commit 2334a45

Browse files
committed
RandomAccessFile的使用案例
Signed-off-by: BYSocket <qiangqiangli1993@gmail.com>
1 parent 4bc2cbc commit 2334a45

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/org/javacore/io/UsingRandomAccessFile.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package org.javacore.io;
22

3-
import java.io.FileNotFoundException;
43
import java.io.IOException;
54
import java.io.RandomAccessFile;
65

@@ -49,7 +48,7 @@ public static void main(String[] args) throws IOException {
4948
display();
5049

5150
rf = new RandomAccessFile(file, "rw");
52-
rf.seek(5 * 8);// 设置文件指针偏移量
51+
rf.seek(5 * 8);// 设置文件指针偏移量,设置到第5个双精度字节
5352
rf.writeDouble(47.003);
5453
rf.close();
5554

0 commit comments

Comments
 (0)