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

◆ Convert() [1/3]

virtual unsafe void System.Text.Decoder.Convert ( byte * bytes,
int byteCount,
char * chars,
int charCount,
bool flush,
out int bytesUsed,
out int charsUsed,
out bool completed )
inlinevirtualinherited

Reimplemented in System.Text.DecoderDBCS, System.Text.DecoderDBCS, System.Text.DecoderNLS, and System.Text.DecoderNLS.

Definition at line 178 of file Decoder.cs.

179 {
180 if (chars == null || bytes == null)
181 {
182 throw new ArgumentNullException((chars == null) ? "chars" : "bytes", SR.ArgumentNull_Array);
183 }
184 if (byteCount < 0 || charCount < 0)
185 {
186 throw new ArgumentOutOfRangeException((byteCount < 0) ? "byteCount" : "charCount", SR.ArgumentOutOfRange_NeedNonNegNum);
187 }
188 for (bytesUsed = byteCount; bytesUsed > 0; bytesUsed /= 2)
189 {
190 if (GetCharCount(bytes, bytesUsed, flush) <= charCount)
191 {
192 charsUsed = GetChars(bytes, bytesUsed, chars, charCount, flush);
193 completed = bytesUsed == byteCount && (_fallbackBuffer == null || _fallbackBuffer.Remaining == 0);
194 return;
195 }
196 flush = false;
197 }
198 throw new ArgumentException(SR.Argument_ConversionOverflow);
199 }
DecoderFallbackBuffer _fallbackBuffer
Definition Decoder.cs:9
int GetChars(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex)
int GetCharCount(byte[] bytes, int index, int count)

References System.Text.Decoder._fallbackBuffer, System.SR.Argument_ConversionOverflow, System.SR.ArgumentNull_Array, System.SR.ArgumentOutOfRange_NeedNonNegNum, System.byteCount, System.bytes, System.charCount, System.chars, System.Text.Decoder.GetCharCount(), and System.Text.Decoder.GetChars().