I want to change modification timestamp of a binary file. What is the best way for doing this?
Would opening and closing the file be a good option? (I require a solution
I know Apache Ant has a Task which does just that.
See the source code of Touch (which can show you how they do it)
They use FILE_UTILS.setFileLastModified(file, modTime);, which uses ResourceUtils.setLastModified(new FileResource(file), time);, which uses a org.apache.tools.ant.types.resources.Touchable, implemented by org.apache.tools.ant.types.resources.FileResource...
Basically, it is a call to File.setLastModified(modTime)
.