We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2317de6 commit ad38991Copy full SHA for ad38991
1 file changed
io/RandomAccessFileEx.java
@@ -0,0 +1,26 @@
1
+package com.zetcode;
2
+
3
+import java.io.IOException;
4
+import java.io.RandomAccessFile;
5
6
+// RandomAccessFile allows to directly manipulate
7
+// the contents of a file
8
+public class RandomAccessFileEx {
9
10
+ public static void main(String[] args) throws IOException {
11
12
+ try (var raf = new RandomAccessFile("test.txt", "rw")) {
13
14
+ raf.writeBytes("golden ring");
15
16
+ raf.seek(0);
17
+ System.out.println(raf.readLine());
18
19
+ raf.seek(7);
20
+ raf.writeBytes("eagle");
21
22
23
24
+ }
25
26
+}
0 commit comments