Edit

Share via


EncodingExtensions.Convert Method

Definition

Overloads

Convert(Decoder, ReadOnlySequence<Byte>, IBufferWriter<Char>, Boolean, Int64, Boolean)

Converts a ReadOnlySequence<T> to UTF-16 encoded characters and writes the result to writer.

Convert(Decoder, ReadOnlySpan<Byte>, IBufferWriter<Char>, Boolean, Int64, Boolean)

Converts a ReadOnlySpan<T> to chars using decoder and writes the result to writer.

Convert(Encoder, ReadOnlySequence<Char>, IBufferWriter<Byte>, Boolean, Int64, Boolean)

Converts a ReadOnlySequence<T> to encoded bytes and writes the result to writer.

Convert(Encoder, ReadOnlySpan<Char>, IBufferWriter<Byte>, Boolean, Int64, Boolean)

Converts a ReadOnlySpan<T> to bytes using encoder and writes the result to writer.

Convert(Decoder, ReadOnlySequence<Byte>, IBufferWriter<Char>, Boolean, Int64, Boolean)

Source:
EncodingExtensions.cs
Source:
EncodingExtensions.cs
Source:
EncodingExtensions.cs

Converts a ReadOnlySequence<T> to UTF-16 encoded characters and writes the result to writer.

public:
[System::Runtime::CompilerServices::Extension]
 static void Convert(System::Text::Decoder ^ decoder, System::Buffers::ReadOnlySequence<System::Byte> % bytes, System::Buffers::IBufferWriter<char> ^ writer, bool flush, [Runtime::InteropServices::Out] long % charsUsed, [Runtime::InteropServices::Out] bool % completed);
public static void Convert (this System.Text.Decoder decoder, in System.Buffers.ReadOnlySequence<byte> bytes, System.Buffers.IBufferWriter<char> writer, bool flush, out long charsUsed, out bool completed);
static member Convert : System.Text.Decoder * ReadOnlySequence * System.Buffers.IBufferWriter<char> * bool * int64 * bool -> unit
<Extension()>
Public Sub Convert (decoder As Decoder, ByRef bytes As ReadOnlySequence(Of Byte), writer As IBufferWriter(Of Char), flush As Boolean, ByRef charsUsed As Long, ByRef completed As Boolean)

Parameters

decoder
Decoder

The decoder instance that can convert bytes to char values.

bytes
ReadOnlySequence<Byte>

A sequence of bytes to decode.

writer
IBufferWriter<Char>

The buffer to which the decoded characters will be written.

flush
Boolean

true to indicate no further data is to be converted; otherwise false.

charsUsed
Int64

When this method returns, contains the count of characters that were written to writer.

completed
Boolean

When this method returns, contains true if decoder contains no partial internal state; otherwise, false. If flush is true, this will always be set to true when the method returns.

Exceptions

bytes contains data that cannot be decoded and decoder is configured to throw when such data is seen.

Applies to

Convert(Decoder, ReadOnlySpan<Byte>, IBufferWriter<Char>, Boolean, Int64, Boolean)

Source:
EncodingExtensions.cs
Source:
EncodingExtensions.cs
Source:
EncodingExtensions.cs

Converts a ReadOnlySpan<T> to chars using decoder and writes the result to writer.

public:
[System::Runtime::CompilerServices::Extension]
 static void Convert(System::Text::Decoder ^ decoder, ReadOnlySpan<System::Byte> bytes, System::Buffers::IBufferWriter<char> ^ writer, bool flush, [Runtime::InteropServices::Out] long % charsUsed, [Runtime::InteropServices::Out] bool % completed);
public static void Convert (this System.Text.Decoder decoder, ReadOnlySpan<byte> bytes, System.Buffers.IBufferWriter<char> writer, bool flush, out long charsUsed, out bool completed);
static member Convert : System.Text.Decoder * ReadOnlySpan<byte> * System.Buffers.IBufferWriter<char> * bool * int64 * bool -> unit
<Extension()>
Public Sub Convert (decoder As Decoder, bytes As ReadOnlySpan(Of Byte), writer As IBufferWriter(Of Char), flush As Boolean, ByRef charsUsed As Long, ByRef completed As Boolean)

Parameters

decoder
Decoder

The decoder instance that can convert bytes to char values.

bytes
ReadOnlySpan<Byte>

A sequence of bytes to decode.

writer
IBufferWriter<Char>

The buffer to which the decoded chars will be written.

flush
Boolean

true to indicate no further data is to be converted; otherwise false.

charsUsed
Int64

When this method returns, contains the count of chars which were written to writer.

completed
Boolean

When this method returns, contains true if decoder contains no partial internal state; otherwise, false. If flush is true, this will always be set to true when the method returns.

Exceptions

bytes contains data that cannot be encoded and decoder is configured to throw when such data is seen.

Applies to

Convert(Encoder, ReadOnlySequence<Char>, IBufferWriter<Byte>, Boolean, Int64, Boolean)

Source:
EncodingExtensions.cs
Source:
EncodingExtensions.cs
Source:
EncodingExtensions.cs

Converts a ReadOnlySequence<T> to encoded bytes and writes the result to writer.

public:
[System::Runtime::CompilerServices::Extension]
 static void Convert(System::Text::Encoder ^ encoder, System::Buffers::ReadOnlySequence<char> % chars, System::Buffers::IBufferWriter<System::Byte> ^ writer, bool flush, [Runtime::InteropServices::Out] long % bytesUsed, [Runtime::InteropServices::Out] bool % completed);
public static void Convert (this System.Text.Encoder encoder, in System.Buffers.ReadOnlySequence<char> chars, System.Buffers.IBufferWriter<byte> writer, bool flush, out long bytesUsed, out bool completed);
static member Convert : System.Text.Encoder * ReadOnlySequence * System.Buffers.IBufferWriter<byte> * bool * int64 * bool -> unit
<Extension()>
Public Sub Convert (encoder As Encoder, ByRef chars As ReadOnlySequence(Of Char), writer As IBufferWriter(Of Byte), flush As Boolean, ByRef bytesUsed As Long, ByRef completed As Boolean)

Parameters

encoder
Encoder

The encoder instance that can convert char values to bytes.

chars
ReadOnlySequence<Char>

A sequence of characters to encode.

writer
IBufferWriter<Byte>

The buffer to which the encoded bytes will be written.

flush
Boolean

true to indicate no further data is to be converted; otherwise false.

bytesUsed
Int64

When this method returns, contains the count of bytes which were written to writer.

completed
Boolean

When this method returns, contains true if all input up until bytesUsed was converted; otherwise, false. If flush is true, this will always be set to true when the method returns.

Exceptions

chars contains data that cannot be encoded and encoder is configured to throw when such data is seen.

Applies to

Convert(Encoder, ReadOnlySpan<Char>, IBufferWriter<Byte>, Boolean, Int64, Boolean)

Source:
EncodingExtensions.cs
Source:
EncodingExtensions.cs
Source:
EncodingExtensions.cs

Converts a ReadOnlySpan<T> to bytes using encoder and writes the result to writer.

public:
[System::Runtime::CompilerServices::Extension]
 static void Convert(System::Text::Encoder ^ encoder, ReadOnlySpan<char> chars, System::Buffers::IBufferWriter<System::Byte> ^ writer, bool flush, [Runtime::InteropServices::Out] long % bytesUsed, [Runtime::InteropServices::Out] bool % completed);
public static void Convert (this System.Text.Encoder encoder, ReadOnlySpan<char> chars, System.Buffers.IBufferWriter<byte> writer, bool flush, out long bytesUsed, out bool completed);
static member Convert : System.Text.Encoder * ReadOnlySpan<char> * System.Buffers.IBufferWriter<byte> * bool * int64 * bool -> unit
<Extension()>
Public Sub Convert (encoder As Encoder, chars As ReadOnlySpan(Of Char), writer As IBufferWriter(Of Byte), flush As Boolean, ByRef bytesUsed As Long, ByRef completed As Boolean)

Parameters

encoder
Encoder

The encoder instance that can convert char values to bytes.

chars
ReadOnlySpan<Char>

A sequence of characters to encode.

writer
IBufferWriter<Byte>

The buffer to which the encoded bytes will be written.

flush
Boolean

true to indicate no further data is to be converted; otherwise false.

bytesUsed
Int64

When this method returns, contains the count of bytes which were written to writer.

completed
Boolean

When this method returns, contains true if encoder contains no partial internal state; otherwise, false. If flush is true, this will always be set to true when the method returns.

Exceptions

chars contains data that cannot be encoded and encoder is configured to throw when such data is seen.

Applies to