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

◆ GetChars() [2/3]

static int System.Text.EncodingExtensions.GetChars ( this Encoding encoding,
in ReadOnlySequence< byte > bytes,
Span< char > chars )
inlinestatic

Definition at line 160 of file EncodingExtensions.cs.

161 {
162 if (encoding == null)
163 {
164 throw new ArgumentNullException("encoding");
165 }
166 if (bytes.IsSingleSegment)
167 {
168 return encoding.GetChars(bytes.FirstSpan, chars);
169 }
171 int length = chars.Length;
172 Decoder decoder = encoding.GetDecoder();
173 bool isSingleSegment;
174 do
175 {
176 readOnlySequence.GetFirstSpan(out var first, out var next);
177 isSingleSegment = readOnlySequence.IsSingleSegment;
178 int chars2 = decoder.GetChars(first, chars, isSingleSegment);
179 chars = chars.Slice(chars2);
181 }
182 while (!isSingleSegment);
183 return length - chars.Length;
184 }

References System.bytes, System.chars, System.Text.Encoding.GetChars(), System.Text.Decoder.GetChars(), System.Text.Encoding.GetDecoder(), and System.length.