Namespaces | ||||
| namespace | Path | |||
Functions | ||||
| File | openFile (const String &path) | |||
| Open a file for read/write and return an File object that can be used for reading and writing. | ||||
| File | createFile (const String &path) | |||
| Create the file for the given name. | ||||
| File | openOrCreateFile (const String &path) | |||
| Opens or creates the file for the given name. | ||||
| int | changeFileOwner (const String &filename, const UserId &userId) | |||
| Change the given file ownership. | ||||
| bool | exists (const String &path) | |||
| ||||
| bool | isExecutable (const String &path) | |||
| Tests if a file is executable. | ||||
| bool | canRead (const String &path) | |||
| ||||
| bool | canWrite (const String &path) | |||
| ||||
| bool | isLink (const String &path) | |||
| Tests if a file is a symbolic link. | ||||
| bool | isDirectory (const String &path) | |||
| ||||
| bool | changeDirectory (const String &path) | |||
| Change to the given directory. | ||||
| bool | makeDirectory (const String &path, int mode=0777) | |||
| Create a directory. | ||||
| bool | getFileSize (const String &path, off_t &size) | |||
| Get the size of the file in bytes. | ||||
| bool | removeDirectory (const String &path) | |||
| Remove the given directory. | ||||
| bool | removeFile (const String &path) | |||
| Remove the given file. | ||||
| bool | getDirectoryContents (const String &path, StringArray &dirEntries) | |||
| Get the names of the files (and directories) in the given directory. | ||||
| bool | renameFile (const String &oldFileName, const String &newFileName) | |||
| Rename the given file to the new name. | ||||
| size_t | read (const FileHandle &hdl, void *bfr, size_t numberOfBytes, off_t offset=-1L) | |||
| Read data from file. | ||||
| size_t | write (FileHandle &hdl, const void *bfr, size_t numberOfBytes, off_t offset=-1L) | |||
| Write data to a file. | ||||
| off_t | seek (const FileHandle &hdl, off_t offset, int whence) | |||
| Seek to a given offset within the file. | ||||
| off_t | tell (const FileHandle &hdl) | |||
| ||||
| void | rewind (const FileHandle &hdl) | |||
| Position the file pointer associated with the given file handle to the beginning of the file. | ||||
| int | close (const FileHandle &hdl) | |||
| Close file handle. | ||||
| int | flush (FileHandle &hdl) | |||
| Flush any buffered data to the file if buffering supported. | ||||
| String | getFileContents (const String &filename) | |||
| Read and return the contents of a text file. | ||||
| StringArray | getFileLines (const String &filename) | |||
| Read and return the lines of a test file. | ||||
| String | readSymbolicLink (const String &path) | |||
| Read the value of a symbolic link. | ||||
| void | initRandomFile (const String &filename) | |||
| bool BLOCXX_NAMESPACE::FileSystem::canRead | ( | const String & | path | ) |
Definition at line 185 of file PosixFileSystem.cpp.
References _ACCESS, and BLOCXX_NAMESPACE::String::c_str().
Referenced by BLOCXX_NAMESPACE::dlSharedLibrary::isFakeLibrary().
| bool BLOCXX_NAMESPACE::FileSystem::canWrite | ( | const String & | path | ) |
Definition at line 191 of file PosixFileSystem.cpp.
References _ACCESS, and BLOCXX_NAMESPACE::String::c_str().
| bool BLOCXX_NAMESPACE::FileSystem::changeDirectory | ( | const String & | path | ) |
Change to the given directory.
| path | The directory to change to |
Definition at line 230 of file PosixFileSystem.cpp.
References _CHDIR, and BLOCXX_NAMESPACE::String::c_str().
| int BLOCXX_NAMESPACE::FileSystem::changeFileOwner | ( | const String & | filename, | |
| const UserId & | userId | |||
| ) |
Change the given file ownership.
| filename | The name of the file to change ownership on. | |
| userId | The user id to change ownership to |
Definition at line 108 of file PosixFileSystem.cpp.
References BLOCXX_NAMESPACE::String::c_str().
| int BLOCXX_NAMESPACE::FileSystem::close | ( | const FileHandle & | hdl | ) |
Close file handle.
| hdl | The file handle to close. |
Definition at line 423 of file PosixFileSystem.cpp.
Referenced by BLOCXX_NAMESPACE::File::close(), BLOCXX_NAMESPACE::closeFile(), BLOCXX_NAMESPACE::SocketBaseImpl::connect(), BLOCXX_NAMESPACE::SocketBaseImpl::disconnect(), initRandomFile(), BLOCXX_NAMESPACE::NwIface::NwIface(), BLOCXX_NAMESPACE::Exec::safePopen(), BLOCXX_NAMESPACE::Select::selectRWEpoll(), and BLOCXX_NAMESPACE::File::~File().
| File BLOCXX_NAMESPACE::FileSystem::createFile | ( | const String & | path | ) |
Create the file for the given name.
| path | The name of the file to create. |
Definition at line 135 of file PosixFileSystem.cpp.
References BLOCXX_NAMESPACE::String::c_str().
| bool BLOCXX_NAMESPACE::FileSystem::exists | ( | const String & | path | ) |
Definition at line 169 of file PosixFileSystem.cpp.
References _ACCESS, and BLOCXX_NAMESPACE::String::c_str().
Referenced by BLOCXX_NAMESPACE::ServerSocketImpl::doListen(), and BLOCXX_NAMESPACE::FileAppender::doProcessLogMessage().
| int BLOCXX_NAMESPACE::FileSystem::flush | ( | FileHandle & | hdl | ) |
Flush any buffered data to the file if buffering supported.
| hdl | The file handle to flush the buffer on. |
Definition at line 433 of file PosixFileSystem.cpp.
Referenced by BLOCXX_NAMESPACE::File::flush(), and BLOCXX_NAMESPACE::StackTrace::printStackTrace().
| bool BLOCXX_NAMESPACE::FileSystem::getDirectoryContents | ( | const String & | path, | |
| StringArray & | dirEntries | |||
| ) |
Get the names of the files (and directories) in the given directory.
| path | The name of the directory to get the contents of. | |
| dirEntries | The directory contents will be placed in this array. |
Definition at line 274 of file PosixFileSystem.cpp.
References BLOCXX_NAMESPACE::Array< T >::append(), BLOCXX_FILENAME_SEPARATOR, BLOCXX_NAMESPACE::String::c_str(), BLOCXX_NAMESPACE::Array< T >::clear(), and BLOCXX_NAMESPACE::String::endsWith().
| String BLOCXX_NAMESPACE::FileSystem::getFileContents | ( | const String & | filename | ) |
Read and return the contents of a text file.
If the file contains a null character ('\0') then only previous data will be returned.
| filename | The name of the file to read |
| FileSystemException | if the file doesn't exist or reading fails for any reason. |
Definition at line 491 of file PosixFileSystem.cpp.
References BLOCXX_THROW, BLOCXX_NAMESPACE::String::c_str(), and BLOCXX_NAMESPACE::OStringStream::toString().
Referenced by getFileLines().
| StringArray BLOCXX_NAMESPACE::FileSystem::getFileLines | ( | const String & | filename | ) |
Read and return the lines of a test file.
If the file contains a null character ('\0') then only previous data will be returned.
| filename | The name of the file to read |
| FileSystemException | if the file doesn't exist or reading fails for any reason. |
Definition at line 504 of file PosixFileSystem.cpp.
References getFileContents(), and BLOCXX_NAMESPACE::String::tokenize().
| bool BLOCXX_NAMESPACE::FileSystem::getFileSize | ( | const String & | path, | |
| off_t & | size | |||
| ) |
Get the size of the file in bytes.
| path | The name of the file to get the size for. | |
| size | Put the size of the file in this variable. |
Definition at line 242 of file PosixFileSystem.cpp.
References BLOCXX_NAMESPACE::String::c_str().
| void BLOCXX_NAMESPACE::FileSystem::initRandomFile | ( | const String & | filename | ) |
Definition at line 447 of file PosixFileSystem.cpp.
References BLOCXX_THROW, BLOCXX_NAMESPACE::String::c_str(), close(), BLOCXX_NAMESPACE::RandomNumber::getNextNumber(), i, and write().
| bool BLOCXX_NAMESPACE::FileSystem::isDirectory | ( | const String & | path | ) |
Definition at line 210 of file PosixFileSystem.cpp.
References BLOCXX_NAMESPACE::String::c_str().
| bool BLOCXX_NAMESPACE::FileSystem::isExecutable | ( | const String & | path | ) |
Tests if a file is executable.
This method is not available on platforms that do not have support for executable file attributes
Definition at line 177 of file PosixFileSystem.cpp.
References _ACCESS, and BLOCXX_NAMESPACE::String::c_str().
| bool BLOCXX_NAMESPACE::FileSystem::isLink | ( | const String & | path | ) |
Tests if a file is a symbolic link.
This method is not available on platforms that do not have support for symbolic links
Definition at line 198 of file PosixFileSystem.cpp.
References BLOCXX_NAMESPACE::String::c_str().
| bool BLOCXX_NAMESPACE::FileSystem::makeDirectory | ( | const String & | path, | |
| int | mode = 0777 | |||
| ) |
Create a directory.
| path | The name of the directory to create. | |
| mode | specifies the permissions to use. |
Definition at line 236 of file PosixFileSystem.cpp.
References _MKDIR, and BLOCXX_NAMESPACE::String::c_str().
| File BLOCXX_NAMESPACE::FileSystem::openFile | ( | const String & | path | ) |
Open a file for read/write and return an File object that can be used for reading and writing.
Definition at line 120 of file PosixFileSystem.cpp.
References BLOCXX_NAMESPACE::String::c_str().
Referenced by BLOCXX_NAMESPACE::dlSharedLibrary::isFakeLibrary(), and BLOCXX_NAMESPACE::TempFileEnumerationImplBase::readSize().
| File BLOCXX_NAMESPACE::FileSystem::openOrCreateFile | ( | const String & | path | ) |
Opens or creates the file for the given name.
| path | The name of the file to create. |
Definition at line 155 of file PosixFileSystem.cpp.
References BLOCXX_NAMESPACE::String::c_str().
Referenced by BLOCXX_NAMESPACE::ServerSocketImpl::doListen().
| size_t BLOCXX_NAMESPACE::FileSystem::read | ( | const FileHandle & | hdl, | |
| void * | bfr, | |||
| size_t | numberOfBytes, | |||
| off_t | offset = -1L | |||
| ) |
Read data from file.
| hdl | The file handle to perform the read operation on. | |
| bfr | The location where the read operation will place what is read. | |
| numberOfBytes | The number of bytes to read. | |
| offset | The offset to seek to in the file before the read operation is done. -1 will use the current offset. |
Definition at line 326 of file PosixFileSystem.cpp.
Referenced by BLOCXX_NAMESPACE::TmpFileImpl::read(), BLOCXX_NAMESPACE::File::read(), BLOCXX_NAMESPACE::BinarySerialization::read(), and BLOCXX_NAMESPACE::SocketImpl::readAux().
| String BLOCXX_NAMESPACE::FileSystem::readSymbolicLink | ( | const String & | path | ) |
Read the value of a symbolic link.
| path | Path to the symbolic link |
| FileSystemException,: | ENOTDIR, ENOENT, EACCES, ELOOP, EINVAL, EIO, EFAULT, ENOMEM |
Definition at line 510 of file PosixFileSystem.cpp.
References BLOCXX_THROW_ERRNO, BLOCXX_NAMESPACE::String::c_str(), MAXPATHLEN, and BLOCXX_NAMESPACE::FileSystem::Path::realPath().
Referenced by BLOCXX_NAMESPACE::FileSystem::Path::realPath().
| bool BLOCXX_NAMESPACE::FileSystem::removeDirectory | ( | const String & | path | ) |
Remove the given directory.
| path | The name of the directory to remove |
Definition at line 262 of file PosixFileSystem.cpp.
References _RMDIR, and BLOCXX_NAMESPACE::String::c_str().
| bool BLOCXX_NAMESPACE::FileSystem::removeFile | ( | const String & | path | ) |
Remove the given file.
| path | The name of the file to remove. |
Definition at line 268 of file PosixFileSystem.cpp.
References _UNLINK, and BLOCXX_NAMESPACE::String::c_str().
Referenced by BLOCXX_NAMESPACE::ServerSocketImpl::close(), BLOCXX_NAMESPACE::ServerSocketImpl::doListen(), and BLOCXX_NAMESPACE::FileAppender::doProcessLogMessage().
| bool BLOCXX_NAMESPACE::FileSystem::renameFile | ( | const String & | oldFileName, | |
| const String & | newFileName | |||
| ) |
Rename the given file to the new name.
| oldFileName | The name of the file to rename | |
| newFileName | The new name for the oldFileName |
Definition at line 319 of file PosixFileSystem.cpp.
References BLOCXX_NAMESPACE::String::c_str().
Referenced by BLOCXX_NAMESPACE::FileAppender::doProcessLogMessage().
| void BLOCXX_NAMESPACE::FileSystem::rewind | ( | const FileHandle & | hdl | ) |
Position the file pointer associated with the given file handle to the beginning of the file.
| hdl | The file handle to use in the rewind operation. |
Definition at line 413 of file PosixFileSystem.cpp.
Referenced by BLOCXX_NAMESPACE::File::rewind().
| off_t BLOCXX_NAMESPACE::FileSystem::seek | ( | const FileHandle & | hdl, | |
| off_t | offset, | |||
| int | whence | |||
| ) |
Seek to a given offset within the file.
| hdl | The file handle to use in the seek operation. | |
| offset | The offset to seek to relative to the whence parm. | |
| whence | Can be one of the follwing values: SEEK_SET - Seek relative to the beginning of the file. SEEK_CUR - Seek relative to the current position. SEEK_END - Seek relative to the end of the file (bwd). |
Definition at line 386 of file PosixFileSystem.cpp.
Referenced by BLOCXX_NAMESPACE::File::seek().
| off_t BLOCXX_NAMESPACE::FileSystem::tell | ( | const FileHandle & | hdl | ) |
| hdl | The file handle to use in the tell operation. |
Definition at line 403 of file PosixFileSystem.cpp.
Referenced by BLOCXX_NAMESPACE::File::tell().
| size_t BLOCXX_NAMESPACE::FileSystem::write | ( | FileHandle & | hdl, | |
| const void * | bfr, | |||
| size_t | numberOfBytes, | |||
| off_t | offset = -1L | |||
| ) |
Write data to a file.
| hdl | The file handle to perform the write operation on. | |
| bfr | The locaction to get the contents to write. | |
| numberOfBytes | The number of bytes to write. | |
| offset | The offset to seek to in the file before the write operation is done. -1 will use the current offset. |
Definition at line 356 of file PosixFileSystem.cpp.
Referenced by initRandomFile(), BLOCXX_NAMESPACE::Exec::safePopen(), BLOCXX_NAMESPACE::File::write(), BLOCXX_NAMESPACE::BinarySerialization::write(), BLOCXX_NAMESPACE::SocketImpl::writeAux(), BLOCXX_NAMESPACE::BinarySerialization::writeBool(), BLOCXX_NAMESPACE::BinarySerialization::writeString(), and BLOCXX_NAMESPACE::BinarySerialization::writeStringArray().
1.5.3