[#BloombergLP-bdlsb-MemOutStreamBuf]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlsb.adoc[bdlsb]::MemOutStreamBuf
:relfileprefix: ../../
:mrdocs:

This `class` implements the output functionality of the `basic&lowbar;streambuf` protocol, using a user&hyphen;supplied or default `bslma` allocator to supply memory&period;

== Synopsis

Declared in `&lt;bdlsb&lowbar;memoutstreambuf&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
class MemOutStreamBuf
    : public std::streambuf
----

== Base Classes

[cols="1,4"]
|===
| Name| Description
| `std::streambuf`
| 
|===

== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bdlsb/MemOutStreamBuf/2constructor-00.adoc[`MemOutStreamBuf`]         [.small]#[constructor]#
| Create an empty stream buffer&period; Optionally specify a `basicAllocator` used to supply memory&period; If `basicAllocator` is 0, the currently installed default allocator is used&period;
| xref:BloombergLP/bdlsb/MemOutStreamBuf/2constructor-07.adoc[`MemOutStreamBuf`]         [.small]#[constructor]#
| Create an empty stream buffer with sufficient initial capacity to accommodate up to the specified `numElements` characters without subsequent reallocation&period; If `numElements &equals;&equals; 0`, an implementation&hyphen;defined initial capacity is used&period; Optionally specify a `basicAllocator` used to supply memory&period; If `basicAllocator` is 0, the currently installed default allocator is used&period;
| xref:BloombergLP/bdlsb/MemOutStreamBuf/2destructor.adoc[`&#126;MemOutStreamBuf`] [.small]#[destructor]# [.small]#[virtual]#
| Destroy this stream buffer&period;
| xref:BloombergLP/bdlsb/MemOutStreamBuf/capacity.adoc[`capacity`] 
| Return the current capacity of the buffer managed by this stream buffer&period;
| xref:BloombergLP/bdlsb/MemOutStreamBuf/data.adoc[`data`] 
| Return the address of the non&hyphen;modifiable character buffer managed by this stream buffer&period;
| xref:BloombergLP/bdlsb/MemOutStreamBuf/length.adoc[`length`] 
| Return the number of valid characters in this stream buffer&period;
| xref:BloombergLP/bdlsb/MemOutStreamBuf/reserveCapacity.adoc[`reserveCapacity`] 
| Reserve sufficient internal capacity to store at least the specified `numCharacters` characters without reallocation&period; Note that if the storage size specified is less than the number of characters already in the buffer, this method has no effect&period;
| xref:BloombergLP/bdlsb/MemOutStreamBuf/reset.adoc[`reset`] 
| Destroy the contents of this stream buffer, return all allocated memory to the allocator, and reset the buffer to the default constructed state&period; Note that `length() &equals;&equals; 0` holds following a call to this method&period;
| xref:BloombergLP/bdlsb/MemOutStreamBuf/2conversion.adoc[`operator BloombergLP::bslmf::NestedTraitDeclaration&lt;MemOutStreamBuf, UsesBslmaAllocator&gt;`] 
| Declare `MemOutStreamBuf` as using a `bslma` allocator&period;
|===


== Protected Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bdlsb/MemOutStreamBuf/overflow.adoc[`overflow`]  [.small]#[virtual]#
| Append the optionally specified `insertionChar` to this stream buffer&apos;s character buffer and return `insertionChar`&period; If `insertionChar` is not specified, `traits&lowbar;type&colon;&colon;eof()` is appended instead&period;
| xref:BloombergLP/bdlsb/MemOutStreamBuf/seekoff.adoc[`seekoff`]  [.small]#[virtual]#
| Set the position indicator to the relative specified `offset` from the base position indicated by the specified `way` and return the resulting absolute position on success or pos&lowbar;type(&hyphen;1) on failure&period; Optionally specify `which` area of the stream buffer&period; The seek operation will fail if `which` does not include the flag `bsl&colon;&colon;ios&lowbar;base&colon;&colon;out` or if the resulting absolute position is less than zero or greater then `length()`&period;
| xref:BloombergLP/bdlsb/MemOutStreamBuf/seekpos.adoc[`seekpos`]  [.small]#[virtual]#
| Set the position indicator to the specified `position` and return the resulting absolute position on success or pos&lowbar;type(&hyphen;1) on failure&period; Optionally specify `which` area of the stream buffer&period; The `seekpos` operation will fail if `which` does not include the flag `bsl&colon;&colon;ios&lowbar;base&colon;&colon;out` or if `position` is less then zero or greater than `length()`&period;
| xref:BloombergLP/bdlsb/MemOutStreamBuf/xsputn.adoc[`xsputn`]  [.small]#[virtual]#
| Write the specified `numChars` characters from the specified `source` to the stream buffer&period; Return the number of characters successfully written&period; The behavior is undefined unless &apos;(source &amp;&amp; 0 &lt; numChars) &verbar;&verbar; 0 &equals;&equals; numChars&apos;&period;
|===



[.small]#Created with https://www.mrdocs.com[MrDocs]#
