I have need in a java application that the file created by my application should not be modified by user, if it is modified then it should get validated.
My approach: I have taken the last modified time of each file in a hashmap and validate the modified file basis on this.
Problem: It is fine for particular session and if i want to persist that information then i have to create another file containing the last modified information that also can modified by user. For now I am not using any database.
So request you to give me a alternative of this i.e. how can i validate file? and is my approach most optimized one?