[#BloombergLP-bslx-TestInStream-getLength] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslx.adoc[bslx]::xref:BloombergLP/bslx/TestInStream.adoc[TestInStream]::getLength :relfileprefix: ../../../ :mrdocs: If required, throw a `TestInStreamException` (see `throwExceptionIfInputLimitExhausted`); otherwise, consume the 8‐bit unsigned integer type code, verify the type of the next value in this stream, consume that 8‐bit unsigned integer or 32‐bit signed integer value representing a length (see the `bslx` package‐level documentation) into the specified `variable` if its type is appropriate, update the cursor location, and return a reference to this stream. Consume an 8‐bit unsigned integer if the most significant bit of this byte is 0, otherwise consume a 32‐bit signed integer and set the most significant bit to zero in the resultant `variable`. If the type is incorrect, then this stream is marked invalid and the value of `variable` is unchanged. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of `variable` is undefined. == Synopsis Declared in `<bslx_testinstream.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:BloombergLP/bslx/TestInStream.adoc[TestInStream]& getLength(int& variable); ---- [.small]#Created with https://www.mrdocs.com[MrDocs]#