#include <File.h>
Static Public Methods | |
| void | mkdir (std::string path, mode_t mode) throw (IOException&) |
| Create a directory. | |
| void | remove (std::string path) throw (IOException&) |
| Remove a file or directory. | |
| void | rename (std::string oldName, std::string newName) throw (IOException&) |
| Rename a file. | |
| void | chmod (std::string path, mode_t mode) throw (IOException&) |
| Change the mode of a file. | |
| mode_t | getMode (std::string path) throw (IOException&) |
| Get the mode of a file. | |
| bool | isDirectory (std::string path) throw (IOException&) |
| Check if the file denoted by path is a directory. | |
| bool | isFile (std::string path) throw (IOException&) |
| Check if the file denoted by path is a regular file. | |
| bool | isCharDevice (std::string path) throw (IOException&) |
| Check if the file denoted by path is a character device. | |
| bool | isBlockDevice (std::string path) throw (IOException&) |
| Check if the file denoted by path is a block device. | |
| bool | isFifo (std::string path) throw (IOException&) |
| Check if the file denoted by path is a FIFO. | |
| bool | isLink (std::string path) throw (IOException&) |
| Check if the file denoted by path is a symbolic link. | |
| bool | isSocket (std::string path) throw (IOException&) |
| Check if the file denoted by path is a socket. | |
| void | chown (std::string path, std::string owner) throw (IOException&) |
| Change the owner of a file. | |
| void | chgrp (std::string path, std::string group) throw (IOException&) |
| Change the group of a file. | |
| bool | exists (std::string path) throw (IOException&) |
| Check if a file exists. | |
| off_t | getSize (std::string path) throw (IOException&) |
| Get the size of a file in bytes. | |
| nlink_t | getLinks (std::string path) throw (IOException&) |
| Get the number of hard links that point to a file. | |
| std::string | getOwner (std::string path) throw (IOException&) |
| Get the name of the owner of a file. | |
| std::string | getGroup (std::string path) throw (IOException&) |
| Get the name of the group of a file. | |
| uid_t | getOwnerID (std::string path) throw (IOException&) |
| Get the ID of the owner of a file. | |
| gid_t | getGroupID (std::string path) throw (IOException&) |
| Get the ID of the group of a file. | |
| time_t | getAccessTime (std::string path) throw (IOException&) |
| Get the time of the last access to a file. | |
| time_t | getChangeTime (std::string path) throw (IOException&) |
| Get the time of the last modification of a file stats. | |
| time_t | getModificationTime (std::string path) throw (IOException&) |
| Get the time of the last change to the contents of a file. | |
| std::string | baseName (std::string path) |
| Get the base name of a path. | |
| std::string | dirName (std::string path) |
| Get the directory name of a path. | |
| void | setWorkDir (std::string path) throw (IOException&) |
| Change current working directory. | |
| std::string | getWorkDir () throw (IOException&) |
| Get current working directory. | |
| List< std::string > | listDir (std::string path, int blockSize=128) throw (IOException&) |
| Return the names of files in a directory. | |
| List< std::string > | wildCard (std::string pattern) throw (IOException&) |
| Return the names of files matching a wildcard pattern. | |
| std::string | readContents (std::string file) throw (IOException&) |
| Read the contents of a file as a string. | |
| util::Blob< char > | readBlob (std::string file) throw (IOException&) |
| Read the contents of a file as a Blob. | |
| List< std::string > | readLines (std::string file, int blockSize=128) throw (IOException&) |
| Read the lines of a text file as a list of strings. | |
|
|
Get the base name of a path. See basename(3) for details. |
|
||||||||||||
|
Change the mode of a file. The mode of a file is most easily formed by a logical OR operation of some of the following: <th>Constant</th><th>Value</th><th>Description</th>
For example, chmod("foo.bar",S_IRUSR | S_IWUSR) sets read and write permissions to the owner of file "foo.bar". |
|
|
Get the directory name of a path. See basename(3) for details. |
|
|
Get the mode of a file.
|
|
|
Get the size of a file in bytes. In many cases, it is useful to cast the returned value to an int. |
|
||||||||||||
|
Return the names of files in a directory. Use the blockSize parameter to adjust the performance of the method. Larger blockSize means more memory is initially allocated to store the directory entries. |
|
||||||||||||
|
Create a directory.
|
|
|
Read the contents of a file as a Blob. The pointer stored into the returned blob is allocated with malloc(), and must be released by the caller. |
|
||||||||||||
|
Read the lines of a text file as a list of strings. Use the blockSize parameter to adjust the performance of the method. Use a large value for large files. |
|
||||||||||||
|
Rename a file. A file can be "renamed" to another directory, effectively performing a "move" operation. |
|
|
Return the names of files matching a wildcard pattern. The pattern may contain any familiar shell wild cards. Examples:
File::wildCard("*.cc"); //matches files with a .cc suffix File::wildCard("[fbx-z]*.txt"); //matches foo.txt, bar.txt, x1.txt etc. File::wildCard("/home/me/code.{cc,h}"); //matches code.cc and code.h |