Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ Convert() [4/4]

static void System.Text.EncodingExtensions.Convert ( this Encoder encoder,
ReadOnlySpan< char > chars,
IBufferWriter< byte > writer,
bool flush,
out long bytesUsed,
out bool completed )
inlinestatic

Definition at line 229 of file EncodingExtensions.cs.

230 {
231 if (encoder == null)
232 {
233 throw new ArgumentNullException("encoder");
234 }
235 if (writer == null)
236 {
237 throw new ArgumentNullException("writer");
238 }
239 long num = 0L;
240 do
241 {
242 int sizeHint = ((chars.Length <= 1048576) ? encoder.GetByteCount(chars, flush) : encoder.GetByteCount(chars.Slice(0, 1048576), flush: false));
243 Span<byte> span = writer.GetSpan(sizeHint);
244 encoder.Convert(chars, span, flush, out var charsUsed, out var bytesUsed2, out completed);
245 chars = chars.Slice(charsUsed);
246 writer.Advance(bytesUsed2);
247 num += bytesUsed2;
248 }
249 while (!chars.IsEmpty);
250 bytesUsed = num;
251 }

References System.chars, System.Text.Encoder.Convert(), System.Text.Encoder.GetByteCount(), System.L, and System.writer.