public class FileEntry
extends java.lang.Object
implements java.io.Serializable
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)
)
If the state of additional 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 and Description |
---|
FileEntry(java.io.File file)
Construct a new monitor for a specified
File . |
FileEntry(FileEntry parent,
java.io.File file)
Construct a new monitor for a specified
File . |
Modifier and Type | Method and Description |
---|---|
FileEntry[] |
getChildren()
Return the directory's files.
|
java.io.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
|
java.lang.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(java.io.File file)
Create a new child instance.
|
boolean |
refresh(java.io.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(java.lang.String name)
Set the file name.
|
public FileEntry(java.io.File file)
File
.file
- The file being monitoredpublic FileEntry(FileEntry parent, java.io.File file)
File
.parent
- The parentfile
- The file being monitoredpublic boolean refresh(java.io.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 totrue
if the file has changed, otherwise false
public FileEntry newChildInstance(java.io.File file)
Custom implementations should override this method to return a new instance of the appropriate type.
file
- The child filepublic FileEntry getParent()
public int getLevel()
public FileEntry[] getChildren()
public void setChildren(FileEntry[] children)
children
- This directory's files, may be nullpublic java.io.File getFile()
public java.lang.String getName()
public void setName(java.lang.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"Copyright © 2010 - 2020 Adobe Systems Incorporated. All Rights Reserved"