|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.peace_tools.core.FileInfo
public class FileInfo
This is a simple class that is used to encapsulate information about a given file. This class was introduced to enable handing back consistent information about files both on local and remote servers.
Field Summary | |
---|---|
private int |
attributes
The various attributes defining the file. |
static int |
DIR_ATTRIB
Bit value indicating if this entry is a directory. |
static int |
EXEC_ATTRIB
Bit value indicating if this entry is executable. |
static int |
FILE_ATTRIB
Bit value indicating if this entry is a regular file. |
private long |
lastModified
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 |
private java.lang.String |
path
The absolute path to the file referenced by this file attribute. |
static int |
READ_ATTRIB
Bit value indicating if this entry is readable. |
private long |
size
The size of the file in bytes. |
static int |
WRITE_ATTRIB
Bit value indicating if this entry is writable. |
Constructor Summary | |
---|---|
FileInfo(java.lang.String absolutePath,
long lastModified,
long size,
int attributes)
Create a complete file information class with all the information. |
Method Summary | |
---|---|
boolean |
canExecute()
Determine if this entry is executable. |
boolean |
canRead()
Determine if this entry is readable. |
boolean |
canWrite()
Determine if this entry is writable. |
boolean |
exists()
Determine if this entry exists. |
long |
getLastModified()
Returns the time that the file denoted by this abstract file information was last modified. |
java.lang.String |
getPath()
The path to the file represented by this object. |
long |
getSize()
The size of the file in bytes. |
boolean |
isDirectory()
Determine if this entry is a directory. |
boolean |
isFile()
Determine if this entry is a regular file. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int DIR_ATTRIB
public static final int FILE_ATTRIB
public static final int READ_ATTRIB
public static final int WRITE_ATTRIB
public static final int EXEC_ATTRIB
private final java.lang.String path
private final long lastModified
private long size
private int attributes
FileInfo.FILE_ATTRIB | FileInfo.READ_ATTRIB
). If the
file does not exist then the attributes must be 0.
Constructor Detail |
---|
public FileInfo(java.lang.String absolutePath, long lastModified, long size, int attributes)
absolutePath
- The absolute path to the given file on
a given host.lastModified
- 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.size
- The size of the file in bytes. This value may
be meaningful only for regular files.attributes
- The various attributes defining the file.
These attributes are built by bitwise OR-ing together the
various attributes defined in this class (ex:
FileInfo.FILE_ATTRIB | FileInfo.READ_ATTRIB
). If the
file does not exist then the attributes must be 0.Method Detail |
---|
public java.lang.String getPath()
public long getSize()
public boolean exists()
public boolean isDirectory()
public boolean isFile()
public boolean canRead()
public boolean canWrite()
public boolean canExecute()
public long getLastModified()
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |