CborReader.PeekState Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Reads the next CBOR token, without advancing the reader.
public:
System::Formats::Cbor::CborReaderState PeekState();
public System.Formats.Cbor.CborReaderState PeekState();
member this.PeekState : unit -> System.Formats.Cbor.CborReaderState
Public Function PeekState () As CborReaderState
Returns
An object that represents the current CBOR reader state.
Exceptions
The underlying data is not a well-formed CBOR encoding.
Remarks
If the reader's current data is not the final block, NeedsMoreData is returned when the next token is incomplete in the current buffer, or when AllowMultipleRootLevelValues is enabled and the buffer ends after a complete root-level value, instead of throwing CborContentException.
Any other returned token state guarantees that the method reading that single token will not fail due to an unexpected end of the data, unless the token declares a definite length that can never fit a single buffer, in which case the reading method throws CborContentException.
Methods consuming multiple tokens at once, such as ReadByteString() on indefinite-length strings or ReadEncodedValue(Boolean), can still throw CborContentException on truncated data.