Implemented tail option.

This commit is contained in:
didfet
2015-03-21 18:43:36 +01:00
parent 6dfd647f24
commit 2a0146bbc7
3 changed files with 20 additions and 1 deletions

View File

@@ -43,6 +43,7 @@ public class FileWatcher {
private Map<File,FileState> newWatchMap = new HashMap<File,FileState>();
private FileState[] savedStates;
private int maxSignatureLength;
private boolean tail = false;
public FileWatcher() {
try {
@@ -60,6 +61,13 @@ public class FileWatcher {
}
}
processModifications();
if(tail) {
for(FileState state : oldWatchMap.values()) {
if(state.getPointer() == 0) {
state.setPointer(state.getSize());
}
}
}
printWatchMap();
}
@@ -324,4 +332,8 @@ public class FileWatcher {
this.maxSignatureLength = maxSignatureLength;
}
public void setTail(boolean tail) {
this.tail = tail;
}
}