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

This `struct` is a namespace for a collection of static methods used for manipulating and accessing `Blob` objects&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
struct BlobUtil;
----

== Static Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bdlbb/BlobUtil/append-09.adoc[`append`] 
| `append` overloads
| xref:BloombergLP/bdlbb/BlobUtil/appendBufferIfValid-07.adoc[`appendBufferIfValid`] 
| `appendBufferIfValid` overloads
| xref:BloombergLP/bdlbb/BlobUtil/appendDataBufferIfValid-0c.adoc[`appendDataBufferIfValid`] 
| `appendDataBufferIfValid` overloads
| xref:BloombergLP/bdlbb/BlobUtil/appendWithCapacityBuffer.adoc[`appendWithCapacityBuffer`] 
| Append the specified `length` bytes from the specified `source` address to the specified `dest`&period; Use the existing capacity in `dest` first, followed by that in the `buffer`, and finally allocate from the blob buffer factory associated with the `dest`&period; Load any unused space into the specified `buffer`&period; The behavior is undefined unless the range `&lsqb;source, source &plus; length)&rsqb;` represents a readable sequence of memory&period;
| xref:BloombergLP/bdlbb/BlobUtil/asciiDump-0a.adoc[`asciiDump`] 
| `asciiDump` overloads
| xref:BloombergLP/bdlbb/BlobUtil/compare.adoc[`compare`] 
| Compare, lexicographically, the data (data length and character data values at each index position) stored by the specified `a` and `b` blobs&period; Return 0 if the data stored by `a` is lexicographically equal to the data stored by `b`, a negative value if `a` is lexicographically less than `b`, and a positive value if `a` is lexicographically greater than `b`&period;
| xref:BloombergLP/bdlbb/BlobUtil/copy-06.adoc[`copy`] 
| `copy` overloads
| xref:BloombergLP/bdlbb/BlobUtil/erase.adoc[`erase`] 
| Erase the specified `length` bytes starting at the specified `offset` from the specified `blob`&period; The behavior is undefined unless `offset &gt;&equals; 0`, `length &gt;&equals; 0`, and `offset &plus; length &lt;&equals; blob&hyphen;&gt;length()`&period;
| xref:BloombergLP/bdlbb/BlobUtil/findBufferIndexAndOffset.adoc[`findBufferIndexAndOffset`] 
| Return a value, designated here as `p`, such that for the specified `blob`, `blob&period;buffer(p&period;first)` is the buffer that contains the byte at the specified `position` in `blob`, and `p&period;second` is the offset corresponding to `position` within said buffer&period; The behavior of this function is undefined unless `0 &lt;&equals; position`, `0 &lt; blob&period;totalSize()`, and `position &lt; blob&period;totalSize()`&period; Note that (1) subsequent changes to `blob` may invalidate the result of this function, and (2) `p&period;first` never indicates a zero&hyphen;size buffer&period;
| xref:BloombergLP/bdlbb/BlobUtil/getContiguousDataBuffer.adoc[`getContiguousDataBuffer`] 
| Obtain contiguous storage for at least the specified `addLength` bytes in the specified `blob` at position `blob&hyphen;&gt;length()`, and then grow `blob&hyphen;&gt;length()` by `addLength`&period; If, upon entry, such storage does not exist in `blob`, first trim the final data buffer, if any, and insert a new buffer obtained from the specified `factory`&period; Return a pointer to the beginning of the storage obtained&period; The behavior of this function is undefined unless `0 &lt; addLength`, and `factory&hyphen;&gt;allocate()`, if called, yields a block of memory of a size at least as large as `addLength`&period;
| xref:BloombergLP/bdlbb/BlobUtil/getContiguousRangeOrCopy.adoc[`getContiguousRangeOrCopy`] 
| Return the address of the byte at the specified `position` in the specified `srcBlob`, if that address is aligned to the optionally specified `alignment` and the specified `length` bytes are stored contiguously&semi; otherwise, _copy_ `length` bytes to the specified buffer `dstBuffer`, and return `dstBuffer`&period; If alignment is not specified, none is enforced&period; (An address is aligned to A if, when converted to an integral value `a`, `a &amp; (A &hyphen; 1)` is 0&period;) The behavior of this function is undefined unless `0 &lt; length`, `0 &lt;&equals; position`, `alignment` is a power of two, `dstBuffer` is aligned as required, `dstBuffer` has room for `length` bytes, and `position &lt;&equals; srcBlob&period;totalSize() &hyphen; length`&period;
| xref:BloombergLP/bdlbb/BlobUtil/hexDump-0f.adoc[`hexDump`] 
| `hexDump` overloads
| xref:BloombergLP/bdlbb/BlobUtil/insert-0e.adoc[`insert`] 
| `insert` overloads
| xref:BloombergLP/bdlbb/BlobUtil/insertBufferIfValid-0f.adoc[`insertBufferIfValid`] 
| `insertBufferIfValid` overloads
| xref:BloombergLP/bdlbb/BlobUtil/padToAlignment.adoc[`padToAlignment`] 
| Append padding bytes to the specified `dest` so that its resulting length is an integer multiple of the specified `alignment`&period; Optionally specify `fillChar` with which the padding is to be filled&period; If `fillChar` is not specified, a 0 byte will be used&period; The behavior is undefined unless `alignment` is a power of 2, and less than or equal to 64&period;
| xref:BloombergLP/bdlbb/BlobUtil/prependDataBufferIfValid-0b.adoc[`prependDataBufferIfValid`] 
| `prependDataBufferIfValid` overloads
| xref:BloombergLP/bdlbb/BlobUtil/prependWithCapacityBuffer.adoc[`prependWithCapacityBuffer`] 
| Prepend the specified `length` bytes from the specified `source` address to the specified `dest`&period; Use the existing capacity in `dest` first if `0 &equals;&equals; dest&hyphen;&gt;length()`, followed by that in the `buffer`, and finally allocate from the blob buffer factory associated with the `dest`&period; Load any unused space into the specified `buffer`&period; The behavior is undefined unless the range `&lsqb;source, source &plus; length)&rsqb;` represents a readable sequence of memory&period;
| xref:BloombergLP/bdlbb/BlobUtil/read.adoc[`read`] 
| Read the specified `numBytes` from the specified `stream` and load it into the specified `dest`, and return a reference to the modifiable `stream`&period;
| xref:BloombergLP/bdlbb/BlobUtil/write-0cc.adoc[`write`] 
| `write` overloads
|===



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