|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object JFile
A JFile object models a file in a hierarchical file system.
Extend this abstract class to create particular kinds of JFiles,
e.g.:
Directory -
a JFile that maintains a list of the files it contains.
TextFile -
a JFile containing text you might want to read.
Directory
,
TextFile
Field Summary | |
static String |
separator
The separator used in pathnames. |
Constructor Summary | |
protected |
JFile(String name,
String creator,
Directory parent)
Construct a new JFile, set owner, parent, creation and modification dates. |
Method Summary | |
String |
getCreateDate()
The date and time of the file's creation. |
String |
getModDate()
The date and time of the file's last modification. |
String |
getName()
The name of the file. |
String |
getOwner()
The file's owner. |
Directory |
getParent()
The Directory containing this file. |
String |
getPathName()
The full path to this file. |
abstract int |
getSize()
The size of the JFile (as defined by the child class).. |
abstract String |
getSuffix()
Suffix used for printing file names (as defined by the child class). |
boolean |
isRoot()
A JFile whose parent is null is defined to be the root (of a tree). |
static void |
main(String[] args)
A unit test of JFile and its subclasses. |
protected void |
setModDate()
Set the modification date to "now". |
void |
setOwner(String owner)
Set the owner for this file. |
String |
toString()
How a JFile represents itself as a String. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final String separator
Constructor Detail |
protected JFile(String name, String creator, Directory parent)
name
- the name for this file (in its parent directory).creator
- the owner of this new file.parent
- the Directory in which this file lives.Method Detail |
public String getCreateDate()
public String getModDate()
public String getName()
public String getOwner()
public Directory getParent()
public String getPathName()
public abstract int getSize()
public abstract String getSuffix()
public boolean isRoot()
public static void main(String[] args)
protected void setModDate()
public void setOwner(String owner)
owner
- the new owner.public String toString()
owner size modDate name+suffix
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |