Table of Contents

Struct Utf8JsonStreamReader

Namespace
NMF.Serialization.Json
Assembly
NMF.Serialization.Json.dll

Denotes a reader that reads directly from a buffer

public ref struct Utf8JsonStreamReader
Inherited Members

Constructors

Utf8JsonStreamReader(Stream, int)

Creates a new stream reader

public Utf8JsonStreamReader(Stream stream, int bufferSize)

Parameters

stream Stream

the underlying stream

bufferSize int

the buffer size

Utf8JsonStreamReader(Utf8JsonReader)

Wraps a Utf8JsonReader

public Utf8JsonStreamReader(Utf8JsonReader jsonReader)

Parameters

jsonReader Utf8JsonReader

the reader that should be wrapped

Properties

CurrentDepth

Gets the current depth of the reader

public readonly int CurrentDepth { get; }

Property Value

int

HasValueSequence

True, if the underlying reader has a value sequence, otherwise False

public readonly bool HasValueSequence { get; }

Property Value

bool

TokenStartIndex

Gets the index, the last processed token starts

public readonly long TokenStartIndex { get; }

Property Value

long

TokenType

Gets the type of the last processed token

public readonly JsonTokenType TokenType { get; }

Property Value

JsonTokenType

ValueSequence

Gets the raw value sequence of the last processed token

public readonly ReadOnlySequence<byte> ValueSequence { get; }

Property Value

ReadOnlySequence<byte>

ValueSpan

Gets the raw value span of the last processed token

public readonly ReadOnlySpan<byte> ValueSpan { get; }

Property Value

ReadOnlySpan<byte>

Methods

Dispose()

Disposes the reader

public readonly void Dispose()

GetBoolean()

Gets the boolean value of the last processed token

public bool GetBoolean()

Returns

bool

true or false

GetByte()

Gets the byte value of the last processed token

public byte GetByte()

Returns

byte

the byte value

GetBytesFromBase64()

Gets the bytes value extracted from a base64 string

public byte[] GetBytesFromBase64()

Returns

byte[]

a byte array

GetComment()

Parses the current token value as a comment

public string GetComment()

Returns

string

the comment

GetDateTime()

Parses the current toen value as a date time

public DateTime GetDateTime()

Returns

DateTime

the datetime

GetDateTimeOffset()

Parses the current token value as a data time offset

public DateTimeOffset GetDateTimeOffset()

Returns

DateTimeOffset

the date time offset

GetDecimal()

Parses the current token value as decimal

public decimal GetDecimal()

Returns

decimal

the decimal

GetDouble()

Parses the current token value as double

public double GetDouble()

Returns

double

the double

GetGuid()

Parses the current token value as guid

public Guid GetGuid()

Returns

Guid

the Guid

GetInt16()

Parses the current token value as short

public short GetInt16()

Returns

short

the short

GetInt32()

Parses the current token value as integer

public int GetInt32()

Returns

int

the integer

GetInt64()

Parses the current token value as long

public long GetInt64()

Returns

long

the long

GetSByte()

Parses the current token value as signed byte

public sbyte GetSByte()

Returns

sbyte

the signed byte

GetSingle()

Parses the current token value as single

public float GetSingle()

Returns

float

the single

GetString()

Parses the current token value as string

public string GetString()

Returns

string

the string

GetUInt32()

Parses the current token value as unsigned integer

public uint GetUInt32()

Returns

uint

the unsigned integer

GetUInt64()

Parses the current token value as unsigned long

public ulong GetUInt64()

Returns

ulong

the unsigned long

Read()

Attempts to read the next token

public bool Read()

Returns

bool

true, if the underlying reader could be moved forward, otherwise false

TryGetBytesFromBase64(out byte[])

Tries to parse the current token value as base64 string

public bool TryGetBytesFromBase64(out byte[] value)

Parameters

value byte[]

the byte array represented as base64 or null, if the token could not be parsed

Returns

bool

true, if the value was successfully parsed, otherwise false

TryGetDateTime(out DateTime)

Tries to parse the current token value as datetime

public bool TryGetDateTime(out DateTime value)

Parameters

value DateTime

the datetime or zero, if the token could not be parsed

Returns

bool

true, if the value was successfully parsed, otherwise false

TryGetDateTimeOffset(out DateTimeOffset)

Tries to parse the current token value as datetime with time zone

public bool TryGetDateTimeOffset(out DateTimeOffset value)

Parameters

value DateTimeOffset

the datetime with timezone or zero, if the token could not be parsed

Returns

bool

true, if the value was successfully parsed, otherwise false

TryGetDecimal(out byte)

Tries to parse the current token value as decimal

public bool TryGetDecimal(out byte value)

Parameters

value byte

the decimal or zero, if the token could not be parsed

Returns

bool

true, if the value was successfully parsed, otherwise false

TryGetDecimal(out decimal)

Tries to parse the current token value as decimal

public bool TryGetDecimal(out decimal value)

Parameters

value decimal

the decimal or zero, if the token could not be parsed

Returns

bool

true, if the value was successfully parsed, otherwise false

TryGetDouble(out double)

Tries to parse the current token value as double

public bool TryGetDouble(out double value)

Parameters

value double

the double or zero, if the token could not be parsed

Returns

bool

true, if the value was successfully parsed, otherwise false

TryGetGuid(out Guid)

Tries to parse the current token value as Guid

public bool TryGetGuid(out Guid value)

Parameters

value Guid

the Guid or zero, if the token could not be parsed

Returns

bool

true, if the value was successfully parsed, otherwise false

TryGetInt16(out short)

Tries to parse the current token value as short

public bool TryGetInt16(out short value)

Parameters

value short

the short or zero, if the token could not be parsed

Returns

bool

true, if the value was successfully parsed, otherwise false

TryGetInt32(out int)

Tries to parse the current token value as integer

public bool TryGetInt32(out int value)

Parameters

value int

the integer or zero, if the token could not be parsed

Returns

bool

true, if the value was successfully parsed, otherwise false

TryGetInt64(out long)

Tries to parse the current token value as long

public bool TryGetInt64(out long value)

Parameters

value long

the long or zero, if the token could not be parsed

Returns

bool

true, if the value was successfully parsed, otherwise false

TryGetSByte(out sbyte)

Tries to parse the current token value as signed byte

public bool TryGetSByte(out sbyte value)

Parameters

value sbyte

the signed byte or zero, if the token could not be parsed

Returns

bool

true, if the value was successfully parsed, otherwise false

TryGetSingle(out float)

Tries to parse the current token value as single

public bool TryGetSingle(out float value)

Parameters

value float

the single or zero, if the token could not be parsed

Returns

bool

true, if the value was successfully parsed, otherwise false

TryGetUInt16(out ushort)

Tries to parse the current token value as unsigned short

public bool TryGetUInt16(out ushort value)

Parameters

value ushort

the unsigned short or zero, if the token could not be parsed

Returns

bool

true, if the value was successfully parsed, otherwise false

TryGetUInt32(out uint)

Tries to parse the current token value as unsigned integer

public bool TryGetUInt32(out uint value)

Parameters

value uint

the unsigned integer or zero, if the token could not be parsed

Returns

bool

true, if the value was successfully parsed, otherwise false

TryGetUInt64(out ulong)

Tries to parse the current token value as unsigned long

public bool TryGetUInt64(out ulong value)

Parameters

value ulong

the unsigned long or zero, if the token could not be parsed

Returns

bool

true, if the value was successfully parsed, otherwise false