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
Utf8JsonStreamReader(Utf8JsonReader)
Wraps a Utf8JsonReader
public Utf8JsonStreamReader(Utf8JsonReader jsonReader)
Parameters
jsonReader
Utf8JsonReaderthe reader that should be wrapped
Properties
CurrentDepth
Gets the current depth of the reader
public readonly int CurrentDepth { get; }
Property Value
HasValueSequence
True, if the underlying reader has a value sequence, otherwise False
public readonly bool HasValueSequence { get; }
Property Value
TokenStartIndex
Gets the index, the last processed token starts
public readonly long TokenStartIndex { get; }
Property Value
TokenType
Gets the type of the last processed token
public readonly JsonTokenType TokenType { get; }
Property Value
ValueSequence
Gets the raw value sequence of the last processed token
public readonly ReadOnlySequence<byte> ValueSequence { get; }
Property Value
ValueSpan
Gets the raw value span of the last processed token
public readonly ReadOnlySpan<byte> ValueSpan { get; }
Property Value
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
DateTimethe 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
DateTimeOffsetthe 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
bytethe 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
decimalthe 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
doublethe 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
Guidthe 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
shortthe 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
intthe 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
longthe 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
sbytethe 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
floatthe 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
ushortthe 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
uintthe 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
ulongthe unsigned long or zero, if the token could not be parsed
Returns
- bool
true, if the value was successfully parsed, otherwise false