[#BloombergLP-bdls-FdStreamBuf] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdls.adoc[bdls]::FdStreamBuf :relfileprefix: ../../ :mrdocs: Stream buffer associated with an opened file descriptor. == Synopsis Declared in `<bdls_fdstreambuf.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- 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 [cols="1,4"] |=== | Name| Description | `std::streambuf` | |=== == Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bdls/FdStreamBuf/2constructor.adoc[`FdStreamBuf`] [.small]#[constructor]# | Create a stream buffer associated with the specified file descriptor. | xref:BloombergLP/bdls/FdStreamBuf/2destructor.adoc[`~FdStreamBuf`] [.small]#[destructor]# [.small]#[virtual]# | Destroy this object and, if `willCloseOnReset` is `true`, close the file descriptor associated with this object, if any. | xref:BloombergLP/bdls/FdStreamBuf/clear.adoc[`clear`] | Release any file descriptor associated with this stream buffer. | xref:BloombergLP/bdls/FdStreamBuf/fileDescriptor.adoc[`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. | xref:BloombergLP/bdls/FdStreamBuf/isOpened.adoc[`isOpened`] | Return `true` if this object is currently associated with a file descriptor, and `false` otherwise. | xref:BloombergLP/bdls/FdStreamBuf/release.adoc[`release`] | Disassociate this stream buffer from its file descriptor without closing it. | xref:BloombergLP/bdls/FdStreamBuf/reset.adoc[`reset`] | Associate this object with the specified file descriptor. | xref:BloombergLP/bdls/FdStreamBuf/willCloseOnReset.adoc[`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 [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bdls/FdStreamBuf/imbue.adoc[`imbue`] [.small]#[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()`. | xref:BloombergLP/bdls/FdStreamBuf/overflow.adoc[`overflow`] [.small]#[virtual]# | Flush the output buffer, optionally appending character `c` first. | xref:BloombergLP/bdls/FdStreamBuf/pbackfail.adoc[`pbackfail`] [.small]#[virtual]# | Put back a character into the input sequence. | xref:BloombergLP/bdls/FdStreamBuf/seekoff.adoc[`seekoff`] [.small]#[virtual]# | Set the file pointer associated with the file descriptor according to the specified `offset` and `whence`: | xref:BloombergLP/bdls/FdStreamBuf/seekpos.adoc[`seekpos`] [.small]#[virtual]# | Seek to `offset` bytes from the beginning of the file. | xref:BloombergLP/bdls/FdStreamBuf/setbuf.adoc[`setbuf`] [.small]#[virtual]# | Use `buffer` of capacity `numBytes` as this object's I/O buffer. | xref:BloombergLP/bdls/FdStreamBuf/showmanyc.adoc[`showmanyc`] [.small]#[virtual]# | Return the number of characters remaining to be read. | xref:BloombergLP/bdls/FdStreamBuf/sync.adoc[`sync`] [.small]#[virtual]# | If in output mode, flush the buffer to the associated file descriptor; otherwise do nothing. Return 0 on success, ‐1 otherwise. | xref:BloombergLP/bdls/FdStreamBuf/underflow.adoc[`underflow`] [.small]#[virtual]# | Replenish the input buffer and return the next character of input. | xref:BloombergLP/bdls/FdStreamBuf/xsgetn.adoc[`xsgetn`] [.small]#[virtual]# | Read up to `numBytes` characters into `buffer`. | xref:BloombergLP/bdls/FdStreamBuf/xsputn.adoc[`xsputn`] [.small]#[virtual]# | Write up to `numBytes` characters from `buffer`. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#