feat(tailer): added parameter to Tailer call

This commit is contained in:
dancingCycle 2021-11-30 10:05:19 -05:00
parent 39a75c0119
commit 13175399f6
1 changed files with 18 additions and 1 deletions

View File

@ -7,13 +7,30 @@ import java.io.File;
public class Main {
//delay between checks of the file for new content in milliseconds
public static final int DELAY_MILLIS = 500;
//set to true to tail from the end of the file, false to tail from the beginning of the file
public static final boolean END = true;
public static void main(String[] args) {
System.out.println("Hello world!");
TailerListener listener = new MyListener();
Tailer tailer = new Tailer(new File("NetPeerManager.log"), listener, 500);
//create and use a Tailer with a Thread
String fileName = "NetPeerManager.log";
//TODO What is the behaviour of the reOpen parameter?
Tailer tailer = new Tailer(new File(fileName), listener, DELAY_MILLIS, END);
tailer.run();
Thread thread = new Thread(tailer);
//optional
thread.setDaemon(true);
thread.start();
return;
}
}