10#ifndef __BE_IO_UTILITY_H
11#define __BE_IO_UTILITY_H
51 const std::string &directory,
52 const std::string &prefix);
68 const std::string &pathname);
92 const std::string &sourcepath,
93 const std::string &targetpath,
94 const bool removesource =
false);
119 const std::string &name);
136 const std::string &pathname);
169 const std::string &pathname);
184 const std::string &pathname);
202 int makePath(
const std::string &path,
const mode_t mode);
225 const std::string &path,
226 std::ios_base::openmode mode = std::ios_base::binary);
258 const std::string &path,
259 std::ios_base::openmode mode = std::ios_base::binary);
288 const std::string &path,
289 std::ios_base::openmode mode = std::ios_base::binary);
409 const std::string &pathname);
432 const std::string &pathname);
465 const std::string &prefix =
"",
466 const std::string &parentDir =
"/tmp");
503 const std::string &prefix =
"",
504 const std::string &parentDir =
"/tmp");
522 const std::string &path);
bool isWritable(const std::string &pathname)
Determine if the real user has write access permissions to this file.
bool isReadable(const std::string &pathname)
Determine if the real user has read access permissions to this file.
void readPipe(void *data, size_t size, int pipeFD)
Read from an open pipe into a buffer.
std::string createTemporaryFile(const std::string &prefix="", const std::string &parentDir="/tmp")
Create a temporary file.
uint64_t getFileSize(const std::string &pathname)
Get the size of a file.
bool fileExists(const std::string &pathname)
Indicate whether a file exists.
void copyDirectoryContents(const std::string &sourcepath, const std::string &targetpath, const bool removesource=false)
Copy the contents of a directory, optionally deleting the source directory contents when done.
void setAsideName(const std::string &name)
Set aside a file or directory name.
Memory::uint8Array readFile(const std::string &path, std::ios_base::openmode mode=std::ios_base::binary)
Read the contents of a file into an 8-bit AutoArray.
uint64_t countLines(const std::string &path)
Count the number of newline characters in a text file.
int makePath(const std::string &path, const mode_t mode)
Create an entire directory tree.
void writeFile(const uint8_t *data, const size_t size, const std::string &path, std::ios_base::openmode mode=std::ios_base::binary)
Write the contents of a buffer to a file.
uint64_t sumDirectoryUsage(const std::string &pathname)
Get the sum of the sizes of all files and directories in a given path.
void removeDirectory(const std::string &directory, const std::string &prefix)
Remove a directory using directory name and parent pathname.
bool pathIsDirectory(const std::string &pathname)
void writePipe(const void *data, size_t size, int pipeFD)
Write the contents of a buffer to a pipe.
This software was developed at the National Institute of Standards and Technology (NIST) by employees...