Hi
It is quite possible not to close the file. For example, to simulate a "tail-f". See the following example
Code:
BufferedReader bff = new BufferedReader(new FileReader("c:\\ex.txt "));
try {
while (true) {
String line;
while ( (line = bff.readLine()) != null ) {
System.out.System.out.println(line);
}
while ( ! bff.ready() ) {
/ / With a bffeak to avoid a loop active:
Thread.sleep(100);
}
}
} finally {
bff.close();
}
By cons of course it only takes into account the changes made at the end of the file.
Bookmarks