|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.commons.io.monitor.FileEntry
public class FileEntry
FileEntry
represents the state of a file or directory, capturing
the following File
attributes at a point in time.
File.getName()
)File.exists()
)File.isDirectory()
)File.lastModified()
)File.length()
) - directories treated as zeroFile.listFiles(java.io.FileFilter)
)
File
attributes is required then create a custom
FileEntry
with properties for those attributes. Override the
newChildInstance(File)
to return a new instance of the appropriate type.
You may also want to override the refresh(File)
method.
FileAlterationObserver
,
Serialized FormConstructor Summary | |
---|---|
FileEntry(File file)
Construct a new monitor for a specified File . |
|
FileEntry(FileEntry parent,
File file)
Construct a new monitor for a specified File . |
Method Summary | |
---|---|
FileEntry[] |
getChildren()
Return the directory's files. |
File |
getFile()
Return the file being monitored. |
long |
getLastModified()
Return the last modified time from the last time it was checked. |
long |
getLength()
Return the length. |
int |
getLevel()
Return the level |
String |
getName()
Return the file name. |
FileEntry |
getParent()
Return the parent entry. |
boolean |
isDirectory()
Indicate whether the file is a directory or not. |
boolean |
isExists()
Indicate whether the file existed the last time it was checked. |
FileEntry |
newChildInstance(File file)
Create a new child instance. |
boolean |
refresh(File file)
Refresh the attributes from the File , indicating
whether the file has changed. |
void |
setChildren(FileEntry[] children)
Set the directory's files. |
void |
setDirectory(boolean directory)
Set whether the file is a directory or not. |
void |
setExists(boolean exists)
Set whether the file existed the last time it was checked. |
void |
setLastModified(long lastModified)
Return the last modified time from the last time it was checked. |
void |
setLength(long length)
Set the length. |
void |
setName(String name)
Set the file name. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FileEntry(File file)
File
.
file
- The file being monitoredpublic FileEntry(FileEntry parent, File file)
File
.
parent
- The parentfile
- The file being monitoredMethod Detail |
---|
public boolean refresh(File file)
File
, indicating
whether the file has changed.
This implementation refreshes the name
, exists
,
directory
, lastModified
and length
properties.
The exists
, directory
, lastModified
and length
properties are compared for changes
file
- the file instance to compare to
true
if the file has changed, otherwise false
public FileEntry newChildInstance(File file)
Custom implementations should override this method to return a new instance of the appropriate type.
file
- The child file
public FileEntry getParent()
public int getLevel()
public FileEntry[] getChildren()
public void setChildren(FileEntry[] children)
children
- This directory's files, may be nullpublic File getFile()
public String getName()
public void setName(String name)
name
- the file namepublic long getLastModified()
public void setLastModified(long lastModified)
lastModified
- The last modified timepublic long getLength()
public void setLength(long length)
length
- the lengthpublic boolean isExists()
public void setExists(boolean exists)
exists
- whether the file exists or notpublic boolean isDirectory()
public void setDirectory(boolean directory)
directory
- whether the file is a directory or not
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |