Package com.iizix.util
Class FileChangedChecker
- java.lang.Object
- com.iizix.util.FileChangedChecker
 
- public class FileChangedChecker extends java.lang.ObjectThis class is used to check for file modifications of the file time stamp and/or the file size.- Author:
- Christopher Mindus
 
- Constructor Summary- Constructors - Constructor - Description - FileChangedChecker(java.io.File file)Creates the file change checker instance.- FileChangedChecker(java.lang.String fileName)Creates the file change checker instance.
 - Method Summary- All Methods Instance Methods Concrete Methods - Modifier and Type - Method - Description - java.lang.String- getFileName()Gets the file name being checked.- boolean- hasChanged()Checks if the file has changed.- boolean- isNewerThan(java.io.File file)Checks if this file is newer than the one specified.- boolean- isNewerThan(java.lang.String fileName)Checks if this file is newer than the one specified.- long- lastModified()Returns 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.
 
- Method Detail- getFileName- public java.lang.String getFileName() Gets 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.
 
 - hasChanged- public boolean hasChanged() Checks if the file has changed.- Returns:
- true if the file has changed in size or last modified time, false otherwise.
 
 - update- public void update() Requests an update of the file size and last modification time, if the file has been changed.
 - lastModified- public 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.
 
 - length- public 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.
 
 - isNewerThan- public boolean isNewerThan(java.io.File file) Checks 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.
 
 - isNewerThan- public boolean isNewerThan(java.lang.String fileName) Checks 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.