[#BloombergLP-bslx-ByteOutStream] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslx.adoc[bslx]::ByteOutStream :relfileprefix: ../../ :mrdocs: This class provides output methods to externalize values, and C‐style arrays of values, of the fundamental integral and floating‐point types, as well as `bsl::string` values. In particular, each `put` method of this class is guaranteed to write stream data that can be read by the corresponding `get` method of `bslx::ByteInStream`. See the `bslx` package‐level documentation for the definition of the BDEX `OutStream` protocol. == Synopsis Declared in `<bslx_byteoutstream.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class ByteOutStream; ---- == Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bslx/ByteOutStream/2constructor-074.adoc[`ByteOutStream`] [.small]#[constructor]# | Constructors | xref:BloombergLP/bslx/ByteOutStream/2destructor.adoc[`~ByteOutStream`] [.small]#[destructor]# | Destroy this object. | xref:BloombergLP/bslx/ByteOutStream/bdexVersionSelector.adoc[`bdexVersionSelector`] | Return the `versionSelector` to be used with `operator<<` for BDEX streaming as per the `bslx` package‐level documentation. | xref:BloombergLP/bslx/ByteOutStream/data.adoc[`data`] | Return the address of the contiguous, non‐modifiable internal memory buffer of this stream. The address will remain valid as long as this stream is not destroyed or modified. The behavior of accessing elements outside the range `[ data() .. data() + (length() ‐ 1) ]` is undefined. | xref:BloombergLP/bslx/ByteOutStream/invalidate.adoc[`invalidate`] | Put this output stream in an invalid state. This function has no effect if this stream is already invalid. | xref:BloombergLP/bslx/ByteOutStream/isValid.adoc[`isValid`] | Return `true` if this stream is valid, and `false` otherwise. An invalid stream is a stream for which an output operation was detected to have failed or `invalidate` was called. | xref:BloombergLP/bslx/ByteOutStream/length.adoc[`length`] | Return the number of bytes in this stream. | xref:BloombergLP/bslx/ByteOutStream/putArrayFloat32.adoc[`putArrayFloat32`] | Write to this stream the consecutive four‐byte IEEE single‐precision floating‐point numbers (in network byte order) comprised of the most‐significant four bytes of each of the specified `numValues` leading entries in the specified `values` (in host byte order), and return a reference to this stream. If this stream is initially invalid, this operation has no effect. The behavior is undefined unless `0 <= numValues` and `values` has sufficient contents. Note that for non‐conforming platforms, this operation may be lossy. | xref:BloombergLP/bslx/ByteOutStream/putArrayFloat64.adoc[`putArrayFloat64`] | Write to this stream the consecutive eight‐byte IEEE double‐precision floating‐point numbers (in network byte order) comprised of the most‐significant eight bytes of each of the specified `numValues` leading entries in the specified `values` (in host byte order), and return a reference to this stream. If this stream is initially invalid, this operation has no effect. The behavior is undefined unless `0 <= numValues` and `values` has sufficient contents. Note that for non‐conforming platforms, this operation may be lossy. | xref:BloombergLP/bslx/ByteOutStream/putArrayInt16.adoc[`putArrayInt16`] | Write to this stream the consecutive two‐byte, two's complement integers (in network byte order) comprised of the least‐significant two bytes of each of the specified `numValues` leading entries in the specified `values` (in host byte order), and return a reference to this stream. If this stream is initially invalid, this operation has no effect. The behavior is undefined unless `0 <= numValues` and `values` has sufficient contents. | xref:BloombergLP/bslx/ByteOutStream/putArrayInt24.adoc[`putArrayInt24`] | Write to this stream the consecutive three‐byte, two's complement integers (in network byte order) comprised of the least‐significant three bytes of each of the specified `numValues` leading entries in the specified `values` (in host byte order), and return a reference to this stream. If this stream is initially invalid, this operation has no effect. The behavior is undefined unless `0 <= numValues` and `values` has sufficient contents. | xref:BloombergLP/bslx/ByteOutStream/putArrayInt32.adoc[`putArrayInt32`] | Write to this stream the consecutive four‐byte, two's complement integers (in network byte order) comprised of the least‐significant four bytes of each of the specified `numValues` leading entries in the specified `values` (in host byte order), and return a reference to this stream. If this stream is initially invalid, this operation has no effect. The behavior is undefined unless `0 <= numValues` and `values` has sufficient contents. | xref:BloombergLP/bslx/ByteOutStream/putArrayInt40.adoc[`putArrayInt40`] | Write to this stream the consecutive five‐byte, two's complement integers (in network byte order) comprised of the least‐significant five bytes of each of the specified `numValues` leading entries in the specified `values` (in host byte order), and return a reference to this stream. If this stream is initially invalid, this operation has no effect. The behavior is undefined unless `0 <= numValues` and `values` has sufficient contents. | xref:BloombergLP/bslx/ByteOutStream/putArrayInt48.adoc[`putArrayInt48`] | Write to this stream the consecutive six‐byte, two's complement integers (in network byte order) comprised of the least‐significant six bytes of each of the specified `numValues` leading entries in the specified `values` (in host byte order), and return a reference to this stream. If this stream is initially invalid, this operation has no effect. The behavior is undefined unless `0 <= numValues` and `values` has sufficient contents. | xref:BloombergLP/bslx/ByteOutStream/putArrayInt56.adoc[`putArrayInt56`] | Write to this stream the consecutive seven‐byte, two's complement integers (in network byte order) comprised of the least‐significant seven bytes of each of the specified `numValues` leading entries in the specified `values` (in host byte order), and return a reference to this stream. If this stream is initially invalid, this operation has no effect. The behavior is undefined unless `0 <= numValues` and `values` has sufficient contents. | xref:BloombergLP/bslx/ByteOutStream/putArrayInt64.adoc[`putArrayInt64`] | Write to this stream the consecutive eight‐byte, two's complement integers (in network byte order) comprised of the least‐significant eight bytes of each of the specified `numValues` leading entries in the specified `values` (in host byte order), and return a reference to this stream. If this stream is initially invalid, this operation has no effect. The behavior is undefined unless `0 <= numValues` and `values` has sufficient contents. | xref:BloombergLP/bslx/ByteOutStream/putArrayInt8-0b.adoc[`putArrayInt8`] | `putArrayInt8` overloads | xref:BloombergLP/bslx/ByteOutStream/putArrayUint16.adoc[`putArrayUint16`] | Write to this stream the consecutive two‐byte, two's complement unsigned integers (in network byte order) comprised of the least‐significant two bytes of each of the specified `numValues` leading entries in the specified `values` (in host byte order), and return a reference to this stream. If this stream is initially invalid, this operation has no effect. The behavior is undefined unless `0 <= numValues` and `values` has sufficient contents. | xref:BloombergLP/bslx/ByteOutStream/putArrayUint24.adoc[`putArrayUint24`] | Write to this stream the consecutive three‐byte, two's complement unsigned integers (in network byte order) comprised of the least‐significant three bytes of each of the specified `numValues` leading entries in the specified `values` (in host byte order), and return a reference to this stream. If this stream is initially invalid, this operation has no effect. The behavior is undefined unless `0 <= numValues` and `values` has sufficient contents. | xref:BloombergLP/bslx/ByteOutStream/putArrayUint32.adoc[`putArrayUint32`] | Write to this stream the consecutive four‐byte, two's complement unsigned integers (in network byte order) comprised of the least‐significant four bytes of each of the specified `numValues` leading entries in the specified `values` (in host byte order), and return a reference to this stream. If this stream is initially invalid, this operation has no effect. The behavior is undefined unless `0 <= numValues` and `values` has sufficient contents. | xref:BloombergLP/bslx/ByteOutStream/putArrayUint40.adoc[`putArrayUint40`] | Write to this stream the consecutive five‐byte, two's complement unsigned integers (in network byte order) comprised of the least‐significant five bytes of each of the specified `numValues` leading entries in the specified `values` (in host byte order), and return a reference to this stream. If this stream is initially invalid, this operation has no effect. The behavior is undefined unless `0 <= numValues` and `values` has sufficient contents. | xref:BloombergLP/bslx/ByteOutStream/putArrayUint48.adoc[`putArrayUint48`] | Write to this stream the consecutive six‐byte, two's complement unsigned integers (in network byte order) comprised of the least‐significant six bytes of each of the specified `numValues` leading entries in the specified `values` (in host byte order), and return a reference to this stream. If this stream is initially invalid, this operation has no effect. The behavior is undefined unless `0 <= numValues` and `values` has sufficient contents. | xref:BloombergLP/bslx/ByteOutStream/putArrayUint56.adoc[`putArrayUint56`] | Write to this stream the consecutive seven‐byte, two's complement unsigned integers (in network byte order) comprised of the least‐significant seven bytes of each of the specified `numValues` leading entries in the specified `values` (in host byte order), and return a reference to this stream. If this stream is initially invalid, this operation has no effect. The behavior is undefined unless `0 <= numValues` and `values` has sufficient contents. | xref:BloombergLP/bslx/ByteOutStream/putArrayUint64.adoc[`putArrayUint64`] | Write to this stream the consecutive eight‐byte, two's complement unsigned integers (in network byte order) comprised of the least‐significant eight bytes of each of the specified `numValues` leading entries in the specified `values` (in host byte order), and return a reference to this stream. If this stream is initially invalid, this operation has no effect. The behavior is undefined unless `0 <= numValues` and `values` has sufficient contents. | xref:BloombergLP/bslx/ByteOutStream/putArrayUint8-0e.adoc[`putArrayUint8`] | `putArrayUint8` overloads | xref:BloombergLP/bslx/ByteOutStream/putFloat32.adoc[`putFloat32`] | Write to this stream the four‐byte IEEE single‐precision floating‐point number (in network byte order) comprised of the most‐significant four bytes of the specified `value` (in host byte order), and return a reference to this stream. If this stream is initially invalid, this operation has no effect. Note that for non‐conforming platforms, this operation may be lossy. | xref:BloombergLP/bslx/ByteOutStream/putFloat64.adoc[`putFloat64`] | Write to this stream the eight‐byte IEEE double‐precision floating‐point number (in network byte order) comprised of the most‐significant eight bytes of the specified `value` (in host byte order), and return a reference to this stream. If this stream is initially invalid, this operation has no effect. Note that for non‐conforming platforms, this operation may be lossy. | xref:BloombergLP/bslx/ByteOutStream/putInt16.adoc[`putInt16`] | Write to this stream the two‐byte, two's complement integer (in network byte order) comprised of the least‐significant two bytes of the specified `value` (in host byte order), and return a reference to this stream. If this stream is initially invalid, this operation has no effect. | xref:BloombergLP/bslx/ByteOutStream/putInt24.adoc[`putInt24`] | Write to this stream the three‐byte, two's complement integer (in network byte order) comprised of the least‐significant three bytes of the specified `value` (in host byte order), and return a reference to this stream. If this stream is initially invalid, this operation has no effect. | xref:BloombergLP/bslx/ByteOutStream/putInt32.adoc[`putInt32`] | Write to this stream the four‐byte, two's complement integer (in network byte order) comprised of the least‐significant four bytes of the specified `value` (in host byte order), and return a reference to this stream. If this stream is initially invalid, this operation has no effect. | xref:BloombergLP/bslx/ByteOutStream/putInt40.adoc[`putInt40`] | Write to this stream the five‐byte, two's complement integer (in network byte order) comprised of the least‐significant five bytes of the specified `value` (in host byte order), and return a reference to this stream. If this stream is initially invalid, this operation has no effect. | xref:BloombergLP/bslx/ByteOutStream/putInt48.adoc[`putInt48`] | Write to this stream the six‐byte, two's complement integer (in network byte order) comprised of the least‐significant six bytes of the specified `value` (in host byte order), and return a reference to this stream. If this stream is initially invalid, this operation has no effect. | xref:BloombergLP/bslx/ByteOutStream/putInt56.adoc[`putInt56`] | Write to this stream the seven‐byte, two's complement integer (in network byte order) comprised of the least‐significant seven bytes of the specified `value` (in host byte order), and return a reference to this stream. If this stream is initially invalid, this operation has no effect. | xref:BloombergLP/bslx/ByteOutStream/putInt64.adoc[`putInt64`] | Write to this stream the eight‐byte, two's complement integer (in network byte order) comprised of the least‐significant eight bytes of the specified `value` (in host byte order), and return a reference to this stream. If this stream is initially invalid, this operation has no effect. | xref:BloombergLP/bslx/ByteOutStream/putInt8.adoc[`putInt8`] | Write to this stream the one‐byte, two's complement integer comprised of the least‐significant one byte of the specified `value`, and return a reference to this stream. If this stream is initially invalid, this operation has no effect. | xref:BloombergLP/bslx/ByteOutStream/putLength.adoc[`putLength`] | If the specified `length` is less than 128, write to this stream the one‐byte integer comprised of the least‐significant one byte of the `length`; otherwise, write to this stream the four‐byte, two's complement integer (in network byte order) comprised of the least‐significant four bytes of the `length` (in host byte order) with the most‐significant bit set. Return a reference to this stream. If this stream is initially invalid, this operation has no effect. The behavior is undefined unless `0 <= length`. | xref:BloombergLP/bslx/ByteOutStream/putString.adoc[`putString`] | Write to this stream the length of the specified `value` (see `putLength`) and an array of one‐byte, two's complement unsigned integers comprised of the least‐significant one byte of each character in the `value`, and return a reference to this stream. If this stream is initially invalid, this operation has no effect. | xref:BloombergLP/bslx/ByteOutStream/putUint16.adoc[`putUint16`] | Write to this stream the two‐byte, two's complement unsigned integer (in network byte order) comprised of the least‐significant two bytes of the specified `value` (in host byte order), and return a reference to this stream. If this stream is initially invalid, this operation has no effect. | xref:BloombergLP/bslx/ByteOutStream/putUint24.adoc[`putUint24`] | Write to this stream the three‐byte, two's complement unsigned integer (in network byte order) comprised of the least‐significant three bytes of the specified `value` (in host byte order), and return a reference to this stream. If this stream is initially invalid, this operation has no effect. | xref:BloombergLP/bslx/ByteOutStream/putUint32.adoc[`putUint32`] | Write to this stream the four‐byte, two's complement unsigned integer (in network byte order) comprised of the least‐significant four bytes of the specified `value` (in host byte order), and return a reference to this stream. If this stream is initially invalid, this operation has no effect. | xref:BloombergLP/bslx/ByteOutStream/putUint40.adoc[`putUint40`] | Write to this stream the five‐byte, two's complement unsigned integer (in network byte order) comprised of the least‐significant five bytes of the specified `value` (in host byte order), and return a reference to this stream. If this stream is initially invalid, this operation has no effect. | xref:BloombergLP/bslx/ByteOutStream/putUint48.adoc[`putUint48`] | Write to this stream the six‐byte, two's complement unsigned integer (in network byte order) comprised of the least‐significant six bytes of the specified `value` (in host byte order), and return a reference to this stream. If this stream is initially invalid, this operation has no effect. | xref:BloombergLP/bslx/ByteOutStream/putUint56.adoc[`putUint56`] | Write to this stream the seven‐byte, two's complement unsigned integer (in network byte order) comprised of the least‐significant seven bytes of the specified `value` (in host byte order), and return a reference to this stream. If this stream is initially invalid, this operation has no effect. | xref:BloombergLP/bslx/ByteOutStream/putUint64.adoc[`putUint64`] | Write to this stream the eight‐byte, two's complement unsigned integer (in network byte order) comprised of the least‐significant eight bytes of the specified `value` (in host byte order), and return a reference to this stream. If this stream is initially invalid, this operation has no effect. | xref:BloombergLP/bslx/ByteOutStream/putUint8.adoc[`putUint8`] | Write to this stream the one‐byte, two's complement unsigned integer comprised of the least‐significant one byte of the specified `value`, and return a reference to this stream. If this stream is initially invalid, this operation has no effect. | xref:BloombergLP/bslx/ByteOutStream/putVersion.adoc[`putVersion`] | Write to this stream the one‐byte, two's complement unsigned integer comprised of the least‐significant one byte of the specified `version`, and return a reference to this stream. If this stream is initially invalid, this operation has no effect. | xref:BloombergLP/bslx/ByteOutStream/reserveCapacity.adoc[`reserveCapacity`] | Set the internal buffer size of this stream to be at least the specified `newCapacity` (in bytes). | xref:BloombergLP/bslx/ByteOutStream/reset.adoc[`reset`] | Remove all content in this stream and validate this stream if it is currently invalid. | xref:BloombergLP/bslx/ByteOutStream/2conversion.adoc[`operator void const*`] | Return a non‐zero value if this stream is valid, and 0 otherwise. An invalid stream is a stream for which an output operation was detected to have failed or `invalidate` was called. |=== == Friends [cols="1,4"] |=== | Name| Description | `xref:BloombergLP/bslx/operator_lshift-0f5.adoc[BloombergLP::bslx::operator<<]` | Write the specified `object` to the specified output `stream` in some reasonable (multi‐line) format, and return a reference to `stream`. |=== == Non-Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bslx/operator_lshift-0fc.adoc[`operator<<`] | Write the specified `value` to the specified output `stream` following the requirements of the BDEX protocol (see the `bslx` package‐level documentation), and return a reference to `stream`. The behavior is undefined unless `TYPE` is BDEX‐compliant. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#