Package com.iizix.util
Class FileChangedChecker
java.lang.Object
com.iizix.util.FileChangedChecker
This class is used to check for file modifications of the file time stamp and/or the file size.
- Author:
- Christopher Mindus
- Constructor SummaryConstructorsConstructorDescription- FileChangedChecker- (File file) Creates the file change checker instance.- FileChangedChecker- (String fileName) Creates the file change checker instance.
- Method SummaryModifier and TypeMethodDescriptionGets the file name being checked.- booleanChecks if the file has changed.- boolean- isNewerThan- (File file) Checks if this file is newer than the one specified.- boolean- isNewerThan- (String fileName) Checks if this file is newer than the one specified.- longReturns the time that the file denoted by this abstract pathname was last modified.- long- length()Returns the length of the file denoted by this abstract pathname.- void- update()Requests an update of the file size and last modification time, if the file has been changed.
- Constructor Details- FileChangedCheckerCreates the file change checker instance.
- FileChangedCheckerCreates the file change checker instance.
 
- Method Details- getFileNameGets the file name being checked.- Returns:
- The file name specified in the constructor or the path to the file name when the instance was constructed with the File parameter.
 
- hasChangedpublic boolean hasChanged()Checks if the file has changed.- Returns:
- true if the file has changed in size or last modified time, false otherwise.
 
- updatepublic void update()Requests an update of the file size and last modification time, if the file has been changed.
- lastModifiedpublic long lastModified()Returns the time that the file denoted by this abstract pathname was last modified.- Returns:
- A long value representing the time the file was last modified, measured in milliseconds since the epoch (00:00:00 GMT, January 1, 1970), or 0L if the file does not exist or if an I/O error occurs.
 
- lengthpublic long length()Returns the length of the file denoted by this abstract pathname. The return value is unspecified if this pathname denotes a directory.- Returns:
- The length, in bytes, of the file denoted by this abstract pathname, or 0L if the file does not exist. Some operating systems may return 0L for pathnames denoting system-dependent entities such as devices or pipes.
 
- isNewerThanChecks if this file is newer than the one specified. A new time stamp is read, the stored one is not used.- Parameters:
- file- The file to compare last modified time with.
- Returns:
- true if this file is newer than the one specified in the parameter, false otherwise.
 
- isNewerThanChecks if this file is newer than the one specified. A new time stamp is read, the stored one is not used.- Parameters:
- fileName- The file name to compare last modified time with.
- Returns:
- true if this file is newer than the one specified in the parameter, false otherwise.