I am making a service that watches a file's readout changes using a stable RecursiveFileObserver
, this file observer will is assigned to observe the file Modifications (FileObserver.MODIFY
) ... What I want this observer to do onEvent
is to change the file's value to what it was before it is changed .. So the cycle is :
Service Starts and observer startsWatching --> File is changed by X --> My Observer changes this to whatever it was before being changed by X ...
So all i need is a way to read what the file's value was before being changed by X .
So can anybody help me in this , and is it even possible ?
This is a snippet of what I am trying to do ...
@Override
public void onEvent(int event, String path) {
// TODO Auto-generated method stub
super.onEvent(event, path);
if(event != MODIFY){
return;
}
if (CoresManagement.isAccessAllowed()){ //If the access is allowed , doesn't do anything ...
return;
}
//Here is where I want to do what I said above
if (path == "le Wild Location"){
modifyFile("le Wild Location" , "Here is the value I want to know , the old value " );
}
please if you find anything unclear i can clarify !