Utf8JsonWriter Utf8JsonWriter Utf8JsonWriter Utf8JsonWriter Class

Definition

Bietet eine leistungsstarke API für das Schreiben von UTF-8-codiertem JSON-Text in Vorwärtsrichtung ohne Zwischenspeicherung.Provides a high-performance API for forward-only, non-cached writing of UTF-8 encoded JSON text.

public ref class Utf8JsonWriter sealed : IAsyncDisposable, IDisposable
public sealed class Utf8JsonWriter : IAsyncDisposable, IDisposable
type Utf8JsonWriter = class
    interface IDisposable
    interface IAsyncDisposable
Public NotInheritable Class Utf8JsonWriter
Implements IAsyncDisposable, IDisposable
Vererbung
Utf8JsonWriterUtf8JsonWriterUtf8JsonWriterUtf8JsonWriter
Implementiert

Hinweise

Utf8JsonWriter schreibt der Text nacheinander mit kein Zwischenspeichern und in der Standardeinstellung entspricht die JSON RFC, mit Ausnahme von das Schreiben von Kommentaren.Utf8JsonWriter writes the text sequentially with no caching and by default adheres to the JSON RFC, with the exception of writing comments.

Eine Methode, die versucht, ungültiges JSON-Format zu schreiben, wenn die Validierung ist aktiviert, löst eine InvalidOperationException mit einer kontextspezifischen Fehlermeldung angezeigt.A method that attempts to write invalid JSON when validation is enabled throws a InvalidOperationException with a context-specific error message. Da dieser Typ einer Referenzstruktur handelt, unterstützt es Async nicht direkt.Since this type is a ref struct, it does not directly support async. Es bietet jedoch Unterstützung für erneutes eintreten, Teil der Daten geschrieben und mit dem Schreiben in kleinen Blöcken fortzufahren.However, it does provide support for reentrancy to write partial data and to continue writing in chunks. Um zum Formatieren der Ausgabe mit Einzug und Leerzeichen oder zum Überspringen der Überprüfung können, erstellen Sie eine Instanz des JsonWriterState und übergeben Sie dies in dem Writer.To be able to format the output with indentation and white space OR to skip validation, create an instance of JsonWriterState and pass that in to the writer.

Konstruktoren

Utf8JsonWriter(IBufferWriter<Byte>, JsonWriterOptions) Utf8JsonWriter(IBufferWriter<Byte>, JsonWriterOptions) Utf8JsonWriter(IBufferWriter<Byte>, JsonWriterOptions) Utf8JsonWriter(IBufferWriter<Byte>, JsonWriterOptions)
Utf8JsonWriter(Stream, JsonWriterOptions) Utf8JsonWriter(Stream, JsonWriterOptions) Utf8JsonWriter(Stream, JsonWriterOptions) Utf8JsonWriter(Stream, JsonWriterOptions)

Eigenschaften

BytesCommitted BytesCommitted BytesCommitted BytesCommitted

Ruft die Gesamtzahl der Bytes ab, für die von Utf8JsonWriter bisher ein Commit an die Ausgabe für die aktuelle Instanz von Utf8JsonWriter ausgeführt wurde.Gets the total number of bytes committed to the output by the Utf8JsonWriter so far for the current instance of the Utf8JsonWriter. Dies gibt an, um wie viel IBufferWriter<T> fortgeschritten ist.This indicates how much the IBufferWriter<T> has advanced.

BytesPending BytesPending BytesPending BytesPending
CurrentDepth CurrentDepth CurrentDepth CurrentDepth

Ruft die Tiefe des aktuellen Tokens ab.Gets the depth of the current token.

Options Options Options Options

Methoden

Dispose() Dispose() Dispose() Dispose()
DisposeAsync() DisposeAsync() DisposeAsync() DisposeAsync()
Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Bestimmt, ob das angegebene Objekt mit dem aktuellen Objekt identisch ist.Determines whether the specified object is equal to the current object.

(Inherited from Object)
Flush() Flush() Flush() Flush()
FlushAsync(CancellationToken) FlushAsync(CancellationToken) FlushAsync(CancellationToken) FlushAsync(CancellationToken)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Fungiert als Standardhashfunktion.Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

Ruft den Type der aktuellen Instanz ab.Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Erstellt eine flache Kopie des aktuellen Object.Creates a shallow copy of the current Object.

(Inherited from Object)
Reset() Reset() Reset() Reset()
Reset(IBufferWriter<Byte>) Reset(IBufferWriter<Byte>) Reset(IBufferWriter<Byte>) Reset(IBufferWriter<Byte>)
Reset(Stream) Reset(Stream) Reset(Stream) Reset(Stream)
ToString() ToString() ToString() ToString()

Gibt eine Zeichenfolge zurück, die das aktuelle Objekt darstellt.Returns a string that represents the current object.

(Inherited from Object)
WriteBoolean(ReadOnlySpan<Byte>, Boolean) WriteBoolean(ReadOnlySpan<Byte>, Boolean) WriteBoolean(ReadOnlySpan<Byte>, Boolean) WriteBoolean(ReadOnlySpan<Byte>, Boolean)
WriteBoolean(ReadOnlySpan<Char>, Boolean) WriteBoolean(ReadOnlySpan<Char>, Boolean) WriteBoolean(ReadOnlySpan<Char>, Boolean) WriteBoolean(ReadOnlySpan<Char>, Boolean)
WriteBoolean(String, Boolean) WriteBoolean(String, Boolean) WriteBoolean(String, Boolean) WriteBoolean(String, Boolean)
WriteBooleanValue(Boolean) WriteBooleanValue(Boolean) WriteBooleanValue(Boolean) WriteBooleanValue(Boolean)

Schreibt den Boolean-Wert (als JSON-Literal „true“ oder „false“) als ein Element eines JSON-Arrays.Writes the Boolean value (as a JSON literal "true" or "false") as an element of a JSON array.

WriteCommentValue(ReadOnlySpan<Byte>) WriteCommentValue(ReadOnlySpan<Byte>) WriteCommentValue(ReadOnlySpan<Byte>) WriteCommentValue(ReadOnlySpan<Byte>)
WriteCommentValue(ReadOnlySpan<Char>) WriteCommentValue(ReadOnlySpan<Char>) WriteCommentValue(ReadOnlySpan<Char>) WriteCommentValue(ReadOnlySpan<Char>)
WriteCommentValue(String) WriteCommentValue(String) WriteCommentValue(String) WriteCommentValue(String)
WriteEndArray() WriteEndArray() WriteEndArray() WriteEndArray()

Schreibt das Ende eines JSON-Arrays.Writes the end of a JSON array.

WriteEndObject() WriteEndObject() WriteEndObject() WriteEndObject()

Schreibt das Ende eines JSON-Objekts.Writes the end of a JSON object.

WriteNull(ReadOnlySpan<Byte>) WriteNull(ReadOnlySpan<Byte>) WriteNull(ReadOnlySpan<Byte>) WriteNull(ReadOnlySpan<Byte>)
WriteNull(ReadOnlySpan<Char>) WriteNull(ReadOnlySpan<Char>) WriteNull(ReadOnlySpan<Char>) WriteNull(ReadOnlySpan<Char>)
WriteNull(String) WriteNull(String) WriteNull(String) WriteNull(String)
WriteNullValue() WriteNullValue() WriteNullValue() WriteNullValue()

Schreibt das JSON-Literal „null“ als ein Element eines JSON-Arrays.Writes the JSON literal "null" as an element of a JSON array.

WriteNumber(ReadOnlySpan<Byte>, Decimal) WriteNumber(ReadOnlySpan<Byte>, Decimal) WriteNumber(ReadOnlySpan<Byte>, Decimal) WriteNumber(ReadOnlySpan<Byte>, Decimal)
WriteNumber(ReadOnlySpan<Byte>, Double) WriteNumber(ReadOnlySpan<Byte>, Double) WriteNumber(ReadOnlySpan<Byte>, Double) WriteNumber(ReadOnlySpan<Byte>, Double)
WriteNumber(ReadOnlySpan<Byte>, Int32) WriteNumber(ReadOnlySpan<Byte>, Int32) WriteNumber(ReadOnlySpan<Byte>, Int32) WriteNumber(ReadOnlySpan<Byte>, Int32)
WriteNumber(ReadOnlySpan<Byte>, Int64) WriteNumber(ReadOnlySpan<Byte>, Int64) WriteNumber(ReadOnlySpan<Byte>, Int64) WriteNumber(ReadOnlySpan<Byte>, Int64)
WriteNumber(ReadOnlySpan<Byte>, Single) WriteNumber(ReadOnlySpan<Byte>, Single) WriteNumber(ReadOnlySpan<Byte>, Single) WriteNumber(ReadOnlySpan<Byte>, Single)
WriteNumber(ReadOnlySpan<Byte>, UInt32) WriteNumber(ReadOnlySpan<Byte>, UInt32) WriteNumber(ReadOnlySpan<Byte>, UInt32) WriteNumber(ReadOnlySpan<Byte>, UInt32)
WriteNumber(ReadOnlySpan<Byte>, UInt64) WriteNumber(ReadOnlySpan<Byte>, UInt64) WriteNumber(ReadOnlySpan<Byte>, UInt64) WriteNumber(ReadOnlySpan<Byte>, UInt64)
WriteNumber(ReadOnlySpan<Char>, Decimal) WriteNumber(ReadOnlySpan<Char>, Decimal) WriteNumber(ReadOnlySpan<Char>, Decimal) WriteNumber(ReadOnlySpan<Char>, Decimal)
WriteNumber(ReadOnlySpan<Char>, Double) WriteNumber(ReadOnlySpan<Char>, Double) WriteNumber(ReadOnlySpan<Char>, Double) WriteNumber(ReadOnlySpan<Char>, Double)
WriteNumber(ReadOnlySpan<Char>, Int32) WriteNumber(ReadOnlySpan<Char>, Int32) WriteNumber(ReadOnlySpan<Char>, Int32) WriteNumber(ReadOnlySpan<Char>, Int32)
WriteNumber(ReadOnlySpan<Char>, Int64) WriteNumber(ReadOnlySpan<Char>, Int64) WriteNumber(ReadOnlySpan<Char>, Int64) WriteNumber(ReadOnlySpan<Char>, Int64)
WriteNumber(ReadOnlySpan<Char>, Single) WriteNumber(ReadOnlySpan<Char>, Single) WriteNumber(ReadOnlySpan<Char>, Single) WriteNumber(ReadOnlySpan<Char>, Single)
WriteNumber(ReadOnlySpan<Char>, UInt32) WriteNumber(ReadOnlySpan<Char>, UInt32) WriteNumber(ReadOnlySpan<Char>, UInt32) WriteNumber(ReadOnlySpan<Char>, UInt32)
WriteNumber(ReadOnlySpan<Char>, UInt64) WriteNumber(ReadOnlySpan<Char>, UInt64) WriteNumber(ReadOnlySpan<Char>, UInt64) WriteNumber(ReadOnlySpan<Char>, UInt64)
WriteNumber(String, Decimal) WriteNumber(String, Decimal) WriteNumber(String, Decimal) WriteNumber(String, Decimal)
WriteNumber(String, Double) WriteNumber(String, Double) WriteNumber(String, Double) WriteNumber(String, Double)
WriteNumber(String, Int32) WriteNumber(String, Int32) WriteNumber(String, Int32) WriteNumber(String, Int32)
WriteNumber(String, Int64) WriteNumber(String, Int64) WriteNumber(String, Int64) WriteNumber(String, Int64)
WriteNumber(String, Single) WriteNumber(String, Single) WriteNumber(String, Single) WriteNumber(String, Single)
WriteNumber(String, UInt32) WriteNumber(String, UInt32) WriteNumber(String, UInt32) WriteNumber(String, UInt32)
WriteNumber(String, UInt64) WriteNumber(String, UInt64) WriteNumber(String, UInt64) WriteNumber(String, UInt64)
WriteNumberValue(Decimal) WriteNumberValue(Decimal) WriteNumberValue(Decimal) WriteNumberValue(Decimal)

Schreibt den Decimal-Wert (als JSON-Zahl) als ein Element eines JSON-Arrays.Writes the Decimal value (as a JSON number) as an element of a JSON array.

WriteNumberValue(Double) WriteNumberValue(Double) WriteNumberValue(Double) WriteNumberValue(Double)

Schreibt den Double-Wert (als JSON-Zahl) als ein Element eines JSON-Arrays.Writes the Double value (as a JSON number) as an element of a JSON array.

WriteNumberValue(Int32) WriteNumberValue(Int32) WriteNumberValue(Int32) WriteNumberValue(Int32)

Schreibt den Int32-Wert (als JSON-Zahl) als ein Element eines JSON-Arrays.Writes the Int32 value (as a JSON number) as an element of a JSON array.

WriteNumberValue(Int64) WriteNumberValue(Int64) WriteNumberValue(Int64) WriteNumberValue(Int64)

Schreibt den Int64-Wert (als JSON-Zahl) als ein Element eines JSON-Arrays.Writes the Int64 value (as a JSON number) as an element of a JSON array.

WriteNumberValue(Single) WriteNumberValue(Single) WriteNumberValue(Single) WriteNumberValue(Single)

Schreibt den Single-Wert (als JSON-Zahl) als ein Element eines JSON-Arrays.Writes the Single value (as a JSON number) as an element of a JSON array.

WriteNumberValue(UInt32) WriteNumberValue(UInt32) WriteNumberValue(UInt32) WriteNumberValue(UInt32)

Schreibt den UInt32-Wert (als JSON-Zahl) als ein Element eines JSON-Arrays.Writes the UInt32 value (as a JSON number) as an element of a JSON array.

WriteNumberValue(UInt64) WriteNumberValue(UInt64) WriteNumberValue(UInt64) WriteNumberValue(UInt64)

Schreibt den UInt64-Wert (als JSON-Zahl) als ein Element eines JSON-Arrays.Writes the UInt64 value (as a JSON number) as an element of a JSON array.

WriteStartArray() WriteStartArray() WriteStartArray() WriteStartArray()

Schreibt den Anfang eines JSON-Arrays.Writes the beginning of a JSON array.

WriteStartArray(ReadOnlySpan<Byte>) WriteStartArray(ReadOnlySpan<Byte>) WriteStartArray(ReadOnlySpan<Byte>) WriteStartArray(ReadOnlySpan<Byte>)
WriteStartArray(ReadOnlySpan<Char>) WriteStartArray(ReadOnlySpan<Char>) WriteStartArray(ReadOnlySpan<Char>) WriteStartArray(ReadOnlySpan<Char>)
WriteStartArray(String) WriteStartArray(String) WriteStartArray(String) WriteStartArray(String)
WriteStartObject() WriteStartObject() WriteStartObject() WriteStartObject()

Schreibt den Anfang eines JSON-Objekts.Writes the beginning of a JSON object.

WriteStartObject(ReadOnlySpan<Byte>) WriteStartObject(ReadOnlySpan<Byte>) WriteStartObject(ReadOnlySpan<Byte>) WriteStartObject(ReadOnlySpan<Byte>)
WriteStartObject(ReadOnlySpan<Char>) WriteStartObject(ReadOnlySpan<Char>) WriteStartObject(ReadOnlySpan<Char>) WriteStartObject(ReadOnlySpan<Char>)
WriteStartObject(String) WriteStartObject(String) WriteStartObject(String) WriteStartObject(String)
WriteString(ReadOnlySpan<Byte>, DateTime) WriteString(ReadOnlySpan<Byte>, DateTime) WriteString(ReadOnlySpan<Byte>, DateTime) WriteString(ReadOnlySpan<Byte>, DateTime)
WriteString(ReadOnlySpan<Byte>, DateTimeOffset) WriteString(ReadOnlySpan<Byte>, DateTimeOffset) WriteString(ReadOnlySpan<Byte>, DateTimeOffset) WriteString(ReadOnlySpan<Byte>, DateTimeOffset)
WriteString(ReadOnlySpan<Byte>, Guid) WriteString(ReadOnlySpan<Byte>, Guid) WriteString(ReadOnlySpan<Byte>, Guid) WriteString(ReadOnlySpan<Byte>, Guid)
WriteString(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>) WriteString(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>) WriteString(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>) WriteString(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>)
WriteString(ReadOnlySpan<Byte>, ReadOnlySpan<Char>) WriteString(ReadOnlySpan<Byte>, ReadOnlySpan<Char>) WriteString(ReadOnlySpan<Byte>, ReadOnlySpan<Char>) WriteString(ReadOnlySpan<Byte>, ReadOnlySpan<Char>)
WriteString(ReadOnlySpan<Byte>, String) WriteString(ReadOnlySpan<Byte>, String) WriteString(ReadOnlySpan<Byte>, String) WriteString(ReadOnlySpan<Byte>, String)
WriteString(ReadOnlySpan<Char>, DateTime) WriteString(ReadOnlySpan<Char>, DateTime) WriteString(ReadOnlySpan<Char>, DateTime) WriteString(ReadOnlySpan<Char>, DateTime)
WriteString(ReadOnlySpan<Char>, DateTimeOffset) WriteString(ReadOnlySpan<Char>, DateTimeOffset) WriteString(ReadOnlySpan<Char>, DateTimeOffset) WriteString(ReadOnlySpan<Char>, DateTimeOffset)
WriteString(ReadOnlySpan<Char>, Guid) WriteString(ReadOnlySpan<Char>, Guid) WriteString(ReadOnlySpan<Char>, Guid) WriteString(ReadOnlySpan<Char>, Guid)
WriteString(ReadOnlySpan<Char>, ReadOnlySpan<Byte>) WriteString(ReadOnlySpan<Char>, ReadOnlySpan<Byte>) WriteString(ReadOnlySpan<Char>, ReadOnlySpan<Byte>) WriteString(ReadOnlySpan<Char>, ReadOnlySpan<Byte>)
WriteString(ReadOnlySpan<Char>, ReadOnlySpan<Char>) WriteString(ReadOnlySpan<Char>, ReadOnlySpan<Char>) WriteString(ReadOnlySpan<Char>, ReadOnlySpan<Char>) WriteString(ReadOnlySpan<Char>, ReadOnlySpan<Char>)
WriteString(ReadOnlySpan<Char>, String) WriteString(ReadOnlySpan<Char>, String) WriteString(ReadOnlySpan<Char>, String) WriteString(ReadOnlySpan<Char>, String)
WriteString(String, DateTime) WriteString(String, DateTime) WriteString(String, DateTime) WriteString(String, DateTime)
WriteString(String, DateTimeOffset) WriteString(String, DateTimeOffset) WriteString(String, DateTimeOffset) WriteString(String, DateTimeOffset)
WriteString(String, Guid) WriteString(String, Guid) WriteString(String, Guid) WriteString(String, Guid)
WriteString(String, ReadOnlySpan<Byte>) WriteString(String, ReadOnlySpan<Byte>) WriteString(String, ReadOnlySpan<Byte>) WriteString(String, ReadOnlySpan<Byte>)
WriteString(String, ReadOnlySpan<Char>) WriteString(String, ReadOnlySpan<Char>) WriteString(String, ReadOnlySpan<Char>) WriteString(String, ReadOnlySpan<Char>)
WriteString(String, String) WriteString(String, String) WriteString(String, String) WriteString(String, String)
WriteStringValue(DateTime) WriteStringValue(DateTime) WriteStringValue(DateTime) WriteStringValue(DateTime)

Schreibt den DateTime-Wert (als JSON-Zeichenfolge) als ein Element eines JSON-Arrays.Writes the DateTime value (as a JSON string) as an element of a JSON array.

WriteStringValue(DateTimeOffset) WriteStringValue(DateTimeOffset) WriteStringValue(DateTimeOffset) WriteStringValue(DateTimeOffset)

Schreibt den DateTimeOffset-Wert (als JSON-Zeichenfolge) als ein Element eines JSON-Arrays.Writes the DateTimeOffset value (as a JSON string) as an element of a JSON array.

WriteStringValue(Guid) WriteStringValue(Guid) WriteStringValue(Guid) WriteStringValue(Guid)

Schreibt den Guid-Wert (als JSON-Zeichenfolge) als ein Element eines JSON-Arrays.Writes the Guid value (as a JSON string) as an element of a JSON array.

WriteStringValue(ReadOnlySpan<Byte>) WriteStringValue(ReadOnlySpan<Byte>) WriteStringValue(ReadOnlySpan<Byte>) WriteStringValue(ReadOnlySpan<Byte>)
WriteStringValue(ReadOnlySpan<Char>) WriteStringValue(ReadOnlySpan<Char>) WriteStringValue(ReadOnlySpan<Char>) WriteStringValue(ReadOnlySpan<Char>)
WriteStringValue(String) WriteStringValue(String) WriteStringValue(String) WriteStringValue(String)

Extension Methods

ConfigureAwait(IAsyncDisposable, Boolean) ConfigureAwait(IAsyncDisposable, Boolean) ConfigureAwait(IAsyncDisposable, Boolean) ConfigureAwait(IAsyncDisposable, Boolean)

Gilt für: