[#BloombergLP-bdlbb-Blob]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlbb.adoc[bdlbb]::Blob
:relfileprefix: ../../
:mrdocs:

`Blob` is an in&hyphen;core container for `BlobBuffer` objects&period; This class is exception&hyphen;neutral with no guarantee of rollback&colon; if an exception is thrown during the invocation of a method on a pre&hyphen;existing instance, the container is left in a valid state, but its value is undefined&period; In no event is memory leaked&period;

== Synopsis

Declared in `&lt;bdlbb&lowbar;blob&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
class Blob;
----

== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bdlbb/Blob/2constructor-07.adoc[`Blob`]         [.small]#[constructor]#
| Constructors
| xref:BloombergLP/bdlbb/Blob/2destructor.adoc[`&#126;Blob`] [.small]#[destructor]#
| Destroy this blob&period;
| xref:BloombergLP/bdlbb/Blob/operator_assign-0d.adoc[`operator&equals;`] 
| Assignment operators
| xref:BloombergLP/bdlbb/Blob/allocator.adoc[`allocator`] 
| Return the allocator used by this object to supply memory&period;
| xref:BloombergLP/bdlbb/Blob/appendBuffer-00.adoc[`appendBuffer`] 
| `appendBuffer` overloads
| xref:BloombergLP/bdlbb/Blob/appendDataBuffer-04.adoc[`appendDataBuffer`] 
| `appendDataBuffer` overloads
| xref:BloombergLP/bdlbb/Blob/buffer.adoc[`buffer`] 
| Return a reference to the non&hyphen;modifiable blob buffer at the specified `index` in this blob&period; The behavior is undefined unless `0 &lt;&equals; index &lt; numBuffers()`&period;
| xref:BloombergLP/bdlbb/Blob/factory.adoc[`factory`] 
| Return the factory used by this object&period;
| xref:BloombergLP/bdlbb/Blob/insertBuffer-0d.adoc[`insertBuffer`] 
| `insertBuffer` overloads
| xref:BloombergLP/bdlbb/Blob/lastDataBufferLength.adoc[`lastDataBufferLength`] 
| Return the length of the last blob buffer in this blob, or 0 if this blob is of 0 length&period;
| xref:BloombergLP/bdlbb/Blob/length.adoc[`length`] 
| Return the length of this blob&period;
| xref:BloombergLP/bdlbb/Blob/moveAndAppendDataBuffers.adoc[`moveAndAppendDataBuffers`] 
| Move the data buffers held by the specified `srcBlob` to this blob appending them to the current data buffers of this blob&period; The behavior is undefined unless the total size of the resulting blob and the total number of buffers in this blob are less than or equal to `INT&lowbar;MAX`&period;
| xref:BloombergLP/bdlbb/Blob/moveBuffers.adoc[`moveBuffers`] 
| Remove all blob buffers from this blob and move the buffers held by the specified `srcBlob` to this blob&period; Note that this method is logically equivalent to&colon; &grave; &ast;this &equals; &ast;srcBlob&semi; srcBlob&hyphen;&gt;removeAll()&semi; &grave; but its implementation is more efficient&period;
| xref:BloombergLP/bdlbb/Blob/moveDataBuffers.adoc[`moveDataBuffers`] 
| Remove all blob buffers from this blob and move the data buffers held by the specified `srcBlob` to this blob&period;
| xref:BloombergLP/bdlbb/Blob/numBuffers.adoc[`numBuffers`] 
| Return the number of blob buffers held by this blob&period;
| xref:BloombergLP/bdlbb/Blob/numDataBuffers.adoc[`numDataBuffers`] 
| Return the number of blob buffers containing data in this blob&period;
| xref:BloombergLP/bdlbb/Blob/prependDataBuffer-0d.adoc[`prependDataBuffer`] 
| `prependDataBuffer` overloads
| xref:BloombergLP/bdlbb/Blob/removeAll.adoc[`removeAll`] 
| Remove all blob buffers from this blob, and set its length to 0&period;
| xref:BloombergLP/bdlbb/Blob/removeBuffer.adoc[`removeBuffer`] 
| Remove the buffer at the specified `index` from this blob, and decrement the length of this blob by the size of `buffer` if the buffer at `index` contains data bytes (i&period;e&period;, if the first byte of `buffer` occurs before the logical end of this blob)&period; Buffers at positions higher than `index` (if any) are shifted down by one index position&period; The behavior is undefined unless `0 &lt;&equals; index &lt; numBuffers()`&period;
| xref:BloombergLP/bdlbb/Blob/removeBuffers.adoc[`removeBuffers`] 
| Remove the specified `numBuffers` starting at the specified `index` from this blob&period; Buffers at positions higher than `index` (if any) are shifted down by `numBuffers` index positions&period; The behavior is undefined unless `0 &lt;&equals; index`, `0 &lt;&equals; numBuffers`, and `index &plus; numBuffers &lt;&equals; numBuffers()`&period;
| xref:BloombergLP/bdlbb/Blob/removeUnusedBuffers.adoc[`removeUnusedBuffers`] 
| Remove any unused capacity buffers from this blob&period; Note that this method does not trim the last data buffer, and that the resulting `totalSize` will be `length` plus any unused capacity in the last buffer having data&period;
| xref:BloombergLP/bdlbb/Blob/replaceDataBuffer.adoc[`replaceDataBuffer`] 
| Replace the data buffer at the specified `index` with the specified `buffer`&period; The behavior is undefined unless `0 &lt;&equals; index &lt; numDataBuffers()` and the total size of the resulting blob does not exceed `INT&lowbar;MAX`&period; Note that this operation is equivalent to&colon; &grave; blob&period;removeBuffer(index)&semi; const int n &equals; blob&period;length()&semi; blob&period;insertBuffer(index, buffer)&semi; blob&period;setLength(n &plus; buffer&period;size())&semi; &grave; but is more efficient&period;
| xref:BloombergLP/bdlbb/Blob/reserveBufferCapacity.adoc[`reserveBufferCapacity`] 
| Allocate sufficient capacity to store at least the specified `numBuffers` buffers&period; The behavior is undefined unless `0 &lt;&equals; numBuffers`&period; Note that this method does not change the length of this blob or add any buffers to it&period; Note also that the internal capacity will be increased to maintain a geometric growth factor&period;
| xref:BloombergLP/bdlbb/Blob/setLength.adoc[`setLength`] 
| Set the length of this blob to the specified `length` and, if `length` is greater than its total size, grow this blob by appending buffers allocated using this object&apos;s underlying `BlobBufferFactory`&period; The behavior is undefined if `length` is a negative value, or if the new length requires growing the blob and this blob has no underlying factory&period;
| xref:BloombergLP/bdlbb/Blob/swap.adoc[`swap`] 
| Efficiently exchange the value of this object with the value of the specified `other` object&period; This method provides the no&hyphen;throw exception&hyphen;safety guarantee&period; The behavior is undefined unless this object was created with the same allocator as `other`&period;
| xref:BloombergLP/bdlbb/Blob/swapBufferRaw.adoc[`swapBufferRaw`] 
| Swap the blob buffer at the specified `index` with the specified `srcBuffer`&period; The behavior is undefined unless `0 &lt;&equals; index &lt; numBuffers()` and `srcBuffer&hyphen;&gt;size() &equals;&equals; buffer(index)&period;size()`&period; Note that other than the buffer swap the state of this object remains unchanged&period;
| xref:BloombergLP/bdlbb/Blob/totalSize.adoc[`totalSize`] 
| Return the sum of the sizes of all blob buffers in this blob (i&period;e&period;, the capacity of this blob)&period;
| xref:BloombergLP/bdlbb/Blob/trimLastDataBuffer.adoc[`trimLastDataBuffer`] 
| Set the size of the last data buffer to `lastDataBufferLength()`&period; If there are no data buffers, or if the last data buffer is full (i&period;e&period;, its size is `lastDataBufferLength()`), then this method has no effect&period; Return the leftover of the trimmed buffer or default constructed `BlobBuffer` if nothing to trim&period; Note that the length of the blob is unchanged, and that capacity buffers (i&period;e&period;, of indices `numDataBuffers()` and higher) are _not_ removed&period;
|===


== Friends

[cols="1,4"]
|===
| Name| Description
| `xref:BloombergLP/bdlbb/operator_not_eq-0f.adoc[BloombergLP::bdlbb::operator!&equals;]`
| Return `true` if the specified `lhs` and `rhs` blobs do not have the same value, and `false` otherwise&period; Two blobs do not have the same value if they do not hold the same buffers, or do not have the same length&period;
| `xref:BloombergLP/bdlbb/operator_eq-06.adoc[BloombergLP::bdlbb::operator&equals;&equals;]`
| Return `true` if the specified `lhs` and `rhs` blobs have the same value, and `false` otherwise&period; Two blobs have the same value if they hold the same buffers, and have the same length&period;
|===

== Non-Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bdlbb/swap-04.adoc[`swap`]
| Efficiently exchange the values of the specified `a` and `b` objects&period; This method provides the no&hyphen;throw exception&hyphen;safety guarantee if both objects were created with the same allocator&period;
|===


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