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

◆ Convert() [2/4]

static void System.Text.EncodingExtensions.Convert ( this Decoder decoder,
ReadOnlySpan< byte > bytes,
IBufferWriter< char > writer,
bool flush,
out long charsUsed,
out bool completed )
inlinestatic

Definition at line 270 of file EncodingExtensions.cs.

271 {
272 if (decoder == null)
273 {
274 throw new ArgumentNullException("decoder");
275 }
276 if (writer == null)
277 {
278 throw new ArgumentNullException("writer");
279 }
280 long num = 0L;
281 do
282 {
283 int sizeHint = ((bytes.Length <= 1048576) ? decoder.GetCharCount(bytes, flush) : decoder.GetCharCount(bytes.Slice(0, 1048576), flush: false));
284 Span<char> span = writer.GetSpan(sizeHint);
285 decoder.Convert(bytes, span, flush, out var bytesUsed, out var charsUsed2, out completed);
286 bytes = bytes.Slice(bytesUsed);
287 writer.Advance(charsUsed2);
288 num += charsUsed2;
289 }
290 while (!bytes.IsEmpty);
291 charsUsed = num;
292 }

References System.bytes, System.Text.Decoder.Convert(), System.Text.Decoder.GetCharCount(), System.L, and System.writer.