Common file functions Additional file-related functions can be added here.
More...
#include <carma/util/FileUtils.h>
|
static time_t | accessTime (const std::string &fileName) |
|
static time_t | changeTime (const std::string &fileName) |
|
static std::string | computeMessageDigest (const std::string &fileName, const DigestType &digestType) |
| compute the specified message digest for the specified file More...
|
|
static std::string | computeSha1Sum (const std::string &fileName) |
| compute the SHA1 sum of the file More...
|
|
static bool | exists (const std::string &fileName) |
| does the specified file exist? More...
|
|
static std::string | getError (const std::string &fileName) |
| get file error diagnostic message More...
|
|
static unsigned | getMonitorDataFlatFileHeaderLength (const unsigned &sigLength) |
| get the length in bytes, including the new line character, of a monitor data flat file having a signature of the specified length More...
|
|
static void | hardLink (const std::string &target, const std::string &link) |
| Create a hard link to a file. More...
|
|
static unsigned | lineCount (const std::string &fileName) |
| get the number of lines in the specified file More...
|
|
static void | makeDirectory (const std::string &path, mode_t mode=S_IRWXU|S_IRWXG|S_IROTH) |
| Make a directory. More...
|
|
static time_t | modificationTime (const std::string &fileName) |
|
static void | readMonitorDataFlatFileHeader (const std::string &fileName, carma::util::frameType &frameCount, std::string &signature) |
| read and parse the header of a monitor data flat file More...
|
|
static void | removeFile (const std::string &target) |
| Delete a file. More...
|
|
static void | rename (const std::string &from, const std::string &to) |
| Rename a file or directory. More...
|
|
static std::vector< std::string > | scandir (const std::string &dir) |
| Return contents of a directory as a vector of strings. More...
|
|
static off_t | size (const std::string &fileName) |
| the total size of the file in bytes More...
|
|
static off64_t | size64 (const std::string &fileName) |
|
static void | writeMonitorDataFlatFileHeader (FILE *&file, const carma::util::frameType &frameCount, const std::string &signature) |
| write the header of a monitor data flat file More...
|
|
Common file functions Additional file-related functions can be added here.
This class contains no state.
Definition at line 32 of file FileUtils.h.
static time_t carma::util::FileUtils::accessTime |
( |
const std::string & |
fileName | ) |
|
|
static |
- Returns
- The last time the file was accessed, e.g. by execve(2), mknod(2), pipe(2), utime(2) and read(2) (of more than zero bytes). An ErrorException is thrown if the file cannot be examined.
- See Also
- stat(2)
static time_t carma::util::FileUtils::changeTime |
( |
const std::string & |
fileName | ) |
|
|
static |
- Returns
- The last time the file was changed by writing or setting inode information (i.e., owner, group, link count, mode). An ErrorException is thrown if the file cannot be examined.
- See Also
- stat(2)
static std::string carma::util::FileUtils::computeMessageDigest |
( |
const std::string & |
fileName, |
|
|
const DigestType & |
digestType |
|
) |
| |
|
static |
compute the specified message digest for the specified file
- Parameters
-
fileName | the file for which to compute the digest |
digestType | the type of digest to compute |
- Returns
- the message digest
static std::string carma::util::FileUtils::computeSha1Sum |
( |
const std::string & |
fileName | ) |
|
|
static |
compute the SHA1 sum of the file
static bool carma::util::FileUtils::exists |
( |
const std::string & |
fileName | ) |
|
|
static |
does the specified file exist?
- Parameters
-
fileName | the file for which to check existence |
- Returns
- true if the file exists, false if not
static std::string carma::util::FileUtils::getError |
( |
const std::string & |
fileName | ) |
|
|
static |
get file error diagnostic message
- Returns
- the diagnostic message associated with the global variable errno
static unsigned carma::util::FileUtils::getMonitorDataFlatFileHeaderLength |
( |
const unsigned & |
sigLength | ) |
|
|
static |
get the length in bytes, including the new line character, of a monitor data flat file having a signature of the specified length
- Parameters
-
sigLength | length in bytes of the tagID/canonical name signature |
- Returns
- the length in bytes of the header including the new line character
static void carma::util::FileUtils::hardLink |
( |
const std::string & |
target, |
|
|
const std::string & |
link |
|
) |
| |
|
static |
Create a hard link to a file.
- Parameters
-
target | Path to target file. |
link | Path to link. |
- Exceptions
-
static unsigned carma::util::FileUtils::lineCount |
( |
const std::string & |
fileName | ) |
|
|
static |
get the number of lines in the specified file
- Parameters
-
- Returns
- the number of lines in the file
- Exceptions
-
static void carma::util::FileUtils::makeDirectory |
( |
const std::string & |
path, |
|
|
mode_t |
mode = S_IRWXU|S_IRWXG|S_IROTH |
|
) |
| |
|
static |
Make a directory.
- Parameters
-
path | Pathname of directory. |
mode | Access permission mode defaults to rwx for user and group and world readable. |
- Exceptions
-
static time_t carma::util::FileUtils::modificationTime |
( |
const std::string & |
fileName | ) |
|
|
static |
- Returns
- The last time the file was modified by e.g. by mknod(2), truncate(2), utime(2) and write(2) (of more than zero bytes). An ErrorException is thrown if the file cannot be examined.
- See Also
- stat(2)
static void carma::util::FileUtils::readMonitorDataFlatFileHeader |
( |
const std::string & |
fileName, |
|
|
carma::util::frameType & |
frameCount, |
|
|
std::string & |
signature |
|
) |
| |
|
static |
read and parse the header of a monitor data flat file
- Parameters
-
fileName | [in] flat file name |
frameCount | [out] the frameCount from the header |
signature | [out] the tagID/canonical name signature from the header |
static void carma::util::FileUtils::removeFile |
( |
const std::string & |
target | ) |
|
|
static |
Delete a file.
- Parameters
-
target | File or directory to remove. |
- Exceptions
-
static void carma::util::FileUtils::rename |
( |
const std::string & |
from, |
|
|
const std::string & |
to |
|
) |
| |
|
static |
Rename a file or directory.
- Parameters
-
from | Current location of file. |
to | Location to move file to. |
- Exceptions
-
static std::vector<std::string> carma::util::FileUtils::scandir |
( |
const std::string & |
dir | ) |
|
|
static |
Return contents of a directory as a vector of strings.
This is a ::scandir wrapper.
static off_t carma::util::FileUtils::size |
( |
const std::string & |
fileName | ) |
|
|
static |
the total size of the file in bytes
static void carma::util::FileUtils::writeMonitorDataFlatFileHeader |
( |
FILE *& |
file, |
|
|
const carma::util::frameType & |
frameCount, |
|
|
const std::string & |
signature |
|
) |
| |
|
static |
write the header of a monitor data flat file
- Parameters
-
file | file descriptor |
frameCount | the frameCount to write to the header |
signature | the tagID/canonical name signature to write to the header |
The documentation for this class was generated from the following file: