BloombergLP::bdls::FdStreamBuf

Stream buffer associated with an opened file descriptor.

Synopsis

Declared in <bdls_fdstreambuf.h>

class FdStreamBuf
    : public std::streambuf

Description

This class, derived from the C++ standard library class bsl::streambuf, is a mechanism that can be associated with an opened file descriptor, and, except for changing the locale, enables the caller to invoke all the standard bsl::streambuf operations on that file descriptor. Note that objects of this class are always in exactly one of the 5 modes outlined in the enum FdStreamBuf::FdStreamBufMode.

Base Classes

NameDescription
std::streambuf

Member Functions

NameDescription
FdStreamBuf [constructor]Create a stream buffer associated with the specified file descriptor.
~FdStreamBuf [destructor] [virtual]Destroy this object and, if willCloseOnReset is true, close the file descriptor associated with this object, if any.
clear Release any file descriptor associated with this stream buffer.
fileDescriptor Return the file descriptor associated with this object, or FilesystemUtil::k_INVALID_FD if this object is not currently associated with a file descriptor.
isOpened Return true if this object is currently associated with a file descriptor, and false otherwise.
release Disassociate this stream buffer from its file descriptor without closing it.
reset Associate this object with the specified file descriptor.
willCloseOnReset Return true if this object will close the associated file descriptor the next time it is reset, cleared, or destroyed, and false otherwise.

Protected Member Functions

NameDescription
imbue [virtual]Set the locale for this object. This method has no effect. The behavior is undefined unless the specified locale is the same as bsl::locale().
overflow [virtual]Flush the output buffer, optionally appending character c first.
pbackfail [virtual]Put back a character into the input sequence.
seekoff [virtual]Set the file pointer associated with the file descriptor according to the specified offset and whence:
seekpos [virtual]Seek to offset bytes from the beginning of the file.
setbuf [virtual]Use buffer of capacity numBytes as this object's I/O buffer.
showmanyc [virtual]Return the number of characters remaining to be read.
sync [virtual]If in output mode, flush the buffer to the associated file descriptor; otherwise do nothing. Return 0 on success, -1 otherwise.
underflow [virtual]Replenish the input buffer and return the next character of input.
xsgetn [virtual]Read up to numBytes characters into buffer.
xsputn [virtual]Write up to numBytes characters from buffer.