|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--java.io.File
An instance of this class represents a file or directory.
| Field Summary | |
static String |
pathSeparator
System-dependent path-separator character, represented as a string. |
static char |
pathSeparatorChar
System-dependent path-separator character. |
static String |
separator
System-dependent separator character, represented as a string. |
static char |
separatorChar
System-dependent separator character. |
| Constructor Summary | |
File(File parent,
String child)
Creates a new File instance from a parent path and a child name string. |
|
File(String pathname)
Creates a new File instance from a pathname string. |
|
File(String parent,
String child)
Creates a new File instance from a parent path and a child name string. |
|
| Method Summary | |
boolean |
canRead()
Tests whether the file can be read. |
boolean |
canWrite()
Tests whether the file can be written to. |
boolean |
createNewFile()
Creates a new file. |
boolean |
delete()
Deletes the file. |
boolean |
exists()
Tests if the file exists. |
String |
getName()
Returns the name of the file or directory. |
String |
getPath()
Returns the pathname of the file or directory. |
boolean |
isDirectory()
Tests if the instance is a directory. |
boolean |
isFile()
Tests if the instance is a file. |
long |
lastModified()
Returns the last modified file time in milliseconds, starting at Jan/01/1970, 00:00:00 GMT. |
long |
length()
Returns the absolute size of the file. |
String[] |
list()
Returns an array of strings naming the files and directories in the directory represented by this instance. |
boolean |
mkdir()
Creates a new directory. |
boolean |
mkdirs()
Creates a new directory. |
String |
toString()
Returns the pathname of the file or directory. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode |
| Field Detail |
public static String pathSeparator
public static char pathSeparatorChar
public static String separator
public static char separatorChar
| Constructor Detail |
public File(File parent,
String child)
parent - location for the new file or directory.child - name of the new file or directory.public File(String pathname)
pathname - name of the file or directory.
public File(String parent,
String child)
parent - location for the new file or directory.child - name of the new file or directory.| Method Detail |
public String toString()
toString in class Objectpublic boolean canRead()
public boolean canWrite()
public boolean createNewFile()
throws IOException
IOException - if the file could not be created.public boolean delete()
public boolean exists()
public String getName()
public String getPath()
public boolean isDirectory()
public boolean isFile()
public long lastModified()
public long length()
public String[] list()
public boolean mkdir()
public boolean mkdirs()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||