Dela via


CborWriter Class

Definition

A writer for Concise Binary Object Representation (CBOR) encoded data.

public ref class CborWriter
public class CborWriter
type CborWriter = class
Public Class CborWriter
Inheritance
CborWriter

Constructors

CborWriter(CborConformanceMode, Boolean, Boolean, Int32)

Initializes a new instance of CborWriter class using the specified configuration.

CborWriter(CborConformanceMode, Boolean, Boolean)

Initializes a new instance of CborWriter class using the specified configuration.

Properties

AllowMultipleRootLevelValues

Gets a value that indicates whether this writer allows multiple root-level CBOR data items.

BytesWritten

Gets the total number of bytes that have been written to the buffer.

ConformanceMode

Gets the conformance mode used by this writer.

ConvertIndefiniteLengthEncodings

Gets a value that indicates whether the writer automatically converts indefinite-length encodings into definite-length equivalents.

CurrentDepth

Gets the writer's current level of nestedness in the CBOR document.

IsWriteCompleted

Declares whether the writer has completed writing a complete root-level CBOR document, or sequence of root-level CBOR documents.

Methods

Encode()

Returns a new array containing the encoded value.

Encode(Span<Byte>)

Writes the encoded representation of the data to destination.

Reset()

Resets the writer to have no data, without releasing resources.

TryEncode(Span<Byte>, Int32)

Attempts to write the encoded representation of the data to destination.

WriteBigInteger(BigInteger)

Writes the provided value as a tagged bignum encoding, as described in RFC7049 section 2.4.2.

WriteBoolean(Boolean)

Writes a boolean value (major type 7).

WriteByteString(Byte[])

Writes a buffer as a byte string encoding (major type 2).

WriteByteString(ReadOnlySpan<Byte>)

Writes a buffer as a byte string encoding (major type 2).

WriteCborNegativeIntegerRepresentation(UInt64)

Writes the provided value as a CBOR negative integer representation (major type 1).

WriteDateTimeOffset(DateTimeOffset)

Writes the provided value as a tagged date/time string, as described in RFC7049 section 2.4.1.

WriteDecimal(Decimal)

Writes the provided value value as a tagged decimal fraction encoding, as described in RFC7049 section 2.4.3

WriteDouble(Double)

Writes a double-precision floating point number (major type 7).

WriteEncodedValue(ReadOnlySpan<Byte>)

Writes a single CBOR data item which has already been encoded.

WriteEndArray()

Writes the end of an array (major type 4).

WriteEndIndefiniteLengthByteString()

Writes the end of an indefinite-length byte string (major type 2).

WriteEndIndefiniteLengthTextString()

Writes the end of an indefinite-length UTF-8 string (major type 3).

WriteEndMap()

Writes the end of a map (major type 5).

WriteHalf(Half)

Writes a half-precision floating point number (major type 7).

WriteInt32(Int32)

Writes a value as a signed integer encoding (major types 0,1)

WriteInt64(Int64)

Writes the provided value as a signed integer encoding (major types 0,1)

WriteNull()

Writes a null value (major type 7).

WriteSimpleValue(CborSimpleValue)

Writes a simple value encoding (major type 7).

WriteSingle(Single)

Writes a single-precision floating point number (major type 7).

WriteStartArray(Nullable<Int32>)

Writes the start of a definite or indefinite-length array (major type 4).

WriteStartIndefiniteLengthByteString()

Writes the start of an indefinite-length byte string (major type 2).

WriteStartIndefiniteLengthTextString()

Writes the start of an indefinite-length UTF-8 string (major type 3).

WriteStartMap(Nullable<Int32>)

Writes the start of a definite or indefinite-length map (major type 5).

WriteTag(CborTag)

Assign a semantic tag (major type 6) to the next data item.

WriteTextString(ReadOnlySpan<Char>)

Writes a buffer as a UTF-8 string encoding (major type 3).

WriteTextString(String)

Writes a buffer as a UTF-8 string encoding (major type 3).

WriteUInt32(UInt32)

Writes a value as an unsigned integer encoding (major type 0).

WriteUInt64(UInt64)

Writes a value as an unsigned integer encoding (major type 0).

WriteUnixTimeSeconds(Double)

Writes a unix time in seconds as a tagged date/time value, as described in RFC7049 section 2.4.1.

WriteUnixTimeSeconds(Int64)

Writes a unix time in seconds as a tagged date/time value, as described in RFC7049 section 2.4.1.

Applies to