40         throw Exception(
"Can't open file \"%s\" for writing", fileName.
c_str());
    97     const ptrdiff_t oldPos = 
pos();
    98     const ptrdiff_t written = std::fwrite(dataPtr, 1, dataSize, 
_handle);
    99     _size += MAX<ptrdiff_t>(0, -
static_cast<ptrdiff_t
>(
size()) + oldPos + written);
   113     const size_t oldPos = 
pos();
   119     if (std::fseek(
_handle, newPos, SEEK_SET))
 size_t write(const void *dataPtr, size_t dataSize)
Write data into the stream. 
A class holding an UTF-8 string. 
static size_t evalSeek(ptrdiff_t offset, Origin whence, size_t pos, size_t begin, size_t size)
Evaluate the seek offset relative to whence into a position from the beginning. 
std::FILE * _handle
The actual file handle. 
Basic exceptions to throw. 
const char * c_str() const
Return the (utf8 encoded) string data. 
bool open(const UString &fileName)
Try to open the file with the given fileName. 
bool isOpen() const
Checks if the object opened a file successfully. 
bool empty() const
Is the string empty? 
const Exception kWriteError("Write error")
Exception when writing to a stream failed. 
static UString getDirectory(const UString &p)
Return a path's directory. 
size_t seek(ptrdiff_t offset, Origin whence=SeekableWriteStream::kOriginBegin)
Seek to the speciied offset from the specified origin. 
void flush()
Commit any buffered data to the underlying channel or storage medium; unbuffered streams can use the ...
void close()
Close the file, if open. 
const Exception kSeekError("Seek error")
Exception when seeking a stream failed. 
static bool createDirectories(const UString &path)
Create all directories in this path. 
static UString normalize(const UString &p, bool resolveSymLinks=true)
Normalize a path. 
Origin
The position a seeking offset takes as a base. 
Implementing the stream writing interfaces for files. 
size_t size() const
Return the number of bytes written to the current file in total. 
Utility class for manipulating file paths. 
size_t pos() const
Return the current position ot the stream in the file.