Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
bgColor#ccccff
//Identify a file by its path
String filename = // initialized
RandomAccessFile file = new RandomAccessFile( filename, "rw");


// Write to file...


// Go back to beginning and read contents
file.seek(0);
try {
  while (true) {
    String s = file.readUTF();
    System.out.print(s);
  }
} catch (EOFException x) {
  // ignoreIgnore, this breaks out of while loop
}

br.close();

...