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

◆ Convert() [1/3]

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

Reimplemented in System.Text.OSEncoder, System.Text.OSEncoder, System.Text.EncoderNLS, and System.Text.EncoderNLS.

Definition at line 171 of file Encoder.cs.

172 {
173 if (bytes == null || chars == null)
174 {
175 throw new ArgumentNullException((bytes == null) ? "bytes" : "chars", SR.ArgumentNull_Array);
176 }
177 if (charCount < 0 || byteCount < 0)
178 {
179 throw new ArgumentOutOfRangeException((charCount < 0) ? "charCount" : "byteCount", SR.ArgumentOutOfRange_NeedNonNegNum);
180 }
181 for (charsUsed = charCount; charsUsed > 0; charsUsed /= 2)
182 {
183 if (GetByteCount(chars, charsUsed, flush) <= byteCount)
184 {
185 bytesUsed = GetBytes(chars, charsUsed, bytes, byteCount, flush);
186 completed = charsUsed == charCount && (_fallbackBuffer == null || _fallbackBuffer.Remaining == 0);
187 return;
188 }
189 flush = false;
190 }
191 throw new ArgumentException(SR.Argument_ConversionOverflow);
192 }
int GetBytes(char[] chars, int charIndex, int charCount, byte[] bytes, int byteIndex, bool flush)
EncoderFallbackBuffer _fallbackBuffer
Definition Encoder.cs:9
int GetByteCount(char[] chars, int index, int count, bool flush)

References System.Text.Encoder._fallbackBuffer, System.SR.Argument_ConversionOverflow, System.SR.ArgumentNull_Array, System.SR.ArgumentOutOfRange_NeedNonNegNum, System.byteCount, System.bytes, System.charCount, System.chars, System.Text.Encoder.GetByteCount(), and System.Text.Encoder.GetBytes().