DthingApi
|
Public Member Functions | |
File (String pathname) | |
boolean | createNewFile () throws IOException |
boolean | delete () |
boolean | exists () |
String | getPath () |
boolean | isDirectory () |
boolean | isFile () |
long | lastModified () |
long | length () |
File [] | listFiles () |
long | totalSize () |
long | availableSize () |
String | toString () |
Static Public Attributes | |
static final String | separator |
A representation of file and directory pathnames.
User interfaces and operating systems use system-dependent pathname strings to name files and directories. This class presents a system-independent view of hierarchical pathnames.
Each name part of a pathname string is separated from the next by a single copy of the default separator character. The default name-separator character is defined by the system property file.separator
, and is made available in the public static fields separator
and separatorChar
of this class.
A pathname must be absolute. An absolute pathname is complete in that no other information is required in order to locate the file that it denotes.
Instances of the File
class are immutable; that is, once created, the pathname represented by a File
object will never change.
|
inline |
Creates a new File
instance with the given absolute pathname string. If the given string is the empty string, then the result is the empty absolute pathname.
pathname | A pathname string |
NullPointerException | If the pathname argument is null |
|
inline |
Atomically creates a new, empty file named by this absolute pathname if and only if a file with this name does not yet exist. The check for the existence of the file and the creation of the file if it does not exist are a single operation that is atomic with respect to all other filesystem activities that might affect the file.
true
if the named file does not exist and was successfully created; false
if the named file already exists IOException | If an I/O error occurred |
|
inline |
Deletes the file or directory denoted by this absolute pathname. If this pathname denotes a directory, then the directory must be empty in order to be deleted.
true
if and only if the file or directory is successfully deleted; false
otherwise
|
inline |
Tests whether the file or directory denoted by this absolute pathname exists.
true
if and only if the file or directory denoted by this absolute pathname exists; false
otherwise
|
inline |
|
inline |
Tests whether the file denoted by this absolute pathname is a directory.
true
if and only if the file denoted by this absolute pathname exists and is a directory; false
otherwise
|
inline |
Tests whether the file denoted by this absolute pathname is a normal file. A file is normal if it is not a directory and, in addition, satisfies other system-dependent criteria. Any non-directory file created by a Java application is guaranteed to be a normal file.
true
if and only if the file denoted by this absolute pathname exists and is a normal file; false
otherwise
|
inline |
Returns the time that the file denoted by this absolute pathname was last modified.
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
|
inline |
Returns the length of the file denoted by this absolute pathname. The return value is unspecified if this pathname denotes a directory.
0L
if the file does not exist. Some operating systems may return 0L
for pathnames denoting system-dependent entities such as devices or pipes.
|
inline |
Returns an array of absolute pathnames denoting the files in the directory denoted by this absolute pathname.
If this absolute pathname does not denote a directory, then this method returns
. Otherwise an array of
objects is returned, one for each file or directory in the directory. Pathnames denoting the directory itself and the directory's parent directory are not included in the result.
There is no guarantee that the name strings in the resulting array will appear in any specific order; they are not, in particular, guaranteed to appear in alphabetical order.
|
inline |
Returns the pathname string of this absolute pathname. This is just the string returned by the getPath
method.
|
static |