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

◆ Convert() [2/3]

virtual void System.Text.Decoder.Convert ( byte[] bytes,
int byteIndex,
int byteCount,
char[] chars,
int charIndex,
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, System.Xml.SafeAsciiDecoder, System.Xml.Ucs4Decoder, System.Xml.UTF16Decoder, and System.Text.DecoderNLS.

Definition at line 142 of file Decoder.cs.

143 {
144 if (bytes == null || chars == null)
145 {
146 throw new ArgumentNullException((bytes == null) ? "bytes" : "chars", SR.ArgumentNull_Array);
147 }
148 if (byteIndex < 0 || byteCount < 0)
149 {
150 throw new ArgumentOutOfRangeException((byteIndex < 0) ? "byteIndex" : "byteCount", SR.ArgumentOutOfRange_NeedNonNegNum);
151 }
152 if (charIndex < 0 || charCount < 0)
153 {
154 throw new ArgumentOutOfRangeException((charIndex < 0) ? "charIndex" : "charCount", SR.ArgumentOutOfRange_NeedNonNegNum);
155 }
156 if (bytes.Length - byteIndex < byteCount)
157 {
158 throw new ArgumentOutOfRangeException("bytes", SR.ArgumentOutOfRange_IndexCountBuffer);
159 }
160 if (chars.Length - charIndex < charCount)
161 {
162 throw new ArgumentOutOfRangeException("chars", SR.ArgumentOutOfRange_IndexCountBuffer);
163 }
164 for (bytesUsed = byteCount; bytesUsed > 0; bytesUsed /= 2)
165 {
166 if (GetCharCount(bytes, byteIndex, bytesUsed, flush) <= charCount)
167 {
168 charsUsed = GetChars(bytes, byteIndex, bytesUsed, chars, charIndex, flush);
169 completed = bytesUsed == byteCount && (_fallbackBuffer == null || _fallbackBuffer.Remaining == 0);
170 return;
171 }
172 flush = false;
173 }
174 throw new ArgumentException(SR.Argument_ConversionOverflow);
175 }
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_IndexCountBuffer, System.SR.ArgumentOutOfRange_NeedNonNegNum, System.byteCount, System.byteIndex, System.bytes, System.charCount, System.charIndex, System.chars, System.Text.Decoder.GetCharCount(), and System.Text.Decoder.GetChars().

Referenced by System.Text.Decoder.Convert(), System.Text.EncodingExtensions.Convert(), System.Text.EncodingExtensions.Convert(), System.Xml.XmlTextReaderImpl.GetChars(), System.Xml.XmlTextReaderImpl.InvalidCharRecovery(), System.Text.TranscodingStream.Write(), and System.Text.TranscodingStream.WriteAsync().