Description
Find a BSON cstring terminator from a supplied offset.
Binary and text framing can encode a payload size, container count or terminator. Those fields describe the following data but must still be checked against its actual bytes and complete structure.
Find a BSON cstring terminator from a supplied offset.
When to use this tool
Use BSON Cstring Terminator Offset when decoding one bounded framing or header component.
How to use the tool and how it works
- Enter bytes, start. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- Read terminatorIndex, byteLength. Use the output convention below.
Find a BSON cstring terminator from a supplied offset. Require byte-range entries and whole start in [0,bytes.length]; locate the first zero at or after start, rejecting absence; byteLength excludes the terminator.1
A BSON cstring is terminated by a zero octet. Finding that terminator alone does not validate UTF-8 or the surrounding document.2
| Input field | Meaning and units | Accepted input |
|---|---|---|
| bytes | Octet values, each from 0 through 255, in the stated byte order. | Required. Array of safe integer; maximum items 256. |
| start | Start | Required. Safe integer; minimum 0. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| terminatorIndex | Zero-based absolute index of the first NUL at or after start. | Required. Safe integer. |
| byteLength | Terminator index minus start; excludes the NUL byte. | Required. Safe integer. |
{
"input": {
"bytes": [
1,
65,
66,
0,
9
],
"start": 1
},
"output": {
"terminatorIndex": 3,
"byteLength": 2
}
} Limitations and assumptions
- The result does not validate UTF-8, document framing or bytes before start.
- Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.
- Numeric calculations use binary floating point unless exact decimal-integer arithmetic is explicitly stated. No hidden measurement tolerance or decimal rounding is added; nonfinite or out-of-contract results are rejected. Numeric signed-zero results are exported as zero.
Alternative or Complementary methods
Use a complete parser for payload validity, nested containers, text encoding and record boundaries.
References
Similar or alternative tools
- Netstring Length Prefix Token
Parse a canonical netstring length-prefix token.
- Ascii Control Caret Token Value
Decode one conventional ASCII caret token.