java.io.File
An abstract representation of file and directory pathnames. User interfaces and operating systems use system-dependent pathname strings to name files and directories. This class presents an abstract,system-independent view of hierarchical pathnames.
An abstract pathname has two components:
1. An optional system-dependent prefix string, such as a disk-drive specifier, "/" for the UNIX root directory, or "\\\\" for a Microsoft Windows UNC pathname.
2. A sequence of zero or more string names.
Some methods of File class.
canExecute(): This method tests whether the application can execute the file denoted by this abstract pathname.
canRead(): This method tests whether the application can read the file denoted by this abstract pathname.
canWrite(): This method tests whether the application can modify the file denoted by this abstract pathname.
compareTo(File): This method compares two abstract pathnames lexicographically.
createNewFile(): This method atomically creates a new, empty file named by this abstract pathname if and only if a file with this name does not yet exist.
delete(): This method deletes the file or directory denoted by this abstract pathname.
deleteOnExit(): This method requests that the file or directory denoted by this abstract pathname be deleted when the virtual machine terminates. Files (or directories) are deleted in the reverse order that they are registered.
equals(Object): This method tests this abstract pathname for equality with the given object.
exists(): This method tests whether the file or directory denoted by this abstract path name exists.
getAbsoluteFile(): This method returns the absolute form of this abstract pathname.
getAbsolutePath(): This method returns the absolute pathname string of this abstract pathname.
getCanonicalFile(): This method returns the canonical form of this abstract pathname.
getCanonicalPath(): This method returns the canonical pathname string of this abstract pathname.
getFreeSpace(): This method returns the number of unallocated bytes in the partition named by this abstract path name.
getName(): This method returns the name of the file or directory denoted by this abstract pathname.
getParent(): This method returns the pathname string of this abstract pathname's parent, or null if this pathname does not name a parent directory.
getParentFile(): This method returns the abstract pathname of this abstract pathname's parent, or null if this pathname does not name a parent directory.
getPath(): This method converts this abstract pathname into a pathname string.
getTotalSpace(): This method returns the size of the partition named by this abstract pathname.
getUsableSpace(): This method returns the number of bytes available to this virtual machine on the partition named by this abstract pathname.
hashCode(): This method computes a hash code for this abstract pathname.
isAbsolute(): This method tests whether this abstract pathname is absolute. The definition of absolute pathname is system dependent.
isDirectory(): This method tests whether the file denoted by this abstract pathname is a directory.
isFile(): This method tests whether the file denoted by this abstract pathname is a normal file.
isHidden(): This method tests whether the file named by this abstract pathname is a hidden file.
File class methods in Java Set -2
No comments:
Post a Comment