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

◆ GetBytes() [4/9]

unsafe override int System.Text.UTF8Encoding.GetBytes ( char[] chars,
int charIndex,
int charCount,
byte[] bytes,
int byteIndex )
inlineinherited

Definition at line 252 of file UTF8Encoding.cs.

253 {
254 if (chars == null || bytes == null)
255 {
256 ThrowHelper.ThrowArgumentNullException((chars == null) ? ExceptionArgument.chars : ExceptionArgument.bytes, ExceptionResource.ArgumentNull_Array);
257 }
258 if ((charIndex | charCount) < 0)
259 {
260 ThrowHelper.ThrowArgumentOutOfRangeException((charIndex < 0) ? ExceptionArgument.charIndex : ExceptionArgument.charCount, ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
261 }
262 if (chars.Length - charIndex < charCount)
263 {
264 ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.chars, ExceptionResource.ArgumentOutOfRange_IndexCount);
265 }
266 if ((uint)byteIndex > bytes.Length)
267 {
268 ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.byteIndex, ExceptionResource.ArgumentOutOfRange_Index);
269 }
270 fixed (char* ptr = chars)
271 {
272 fixed (byte* ptr2 = bytes)
273 {
274 return GetBytesCommon(ptr + charIndex, charCount, ptr2 + byteIndex, bytes.Length - byteIndex);
275 }
276 }
277 }
unsafe int GetBytesCommon(char *pChars, int charCount, byte *pBytes, int byteCount)

References System.byteIndex, System.bytes, System.charCount, System.charIndex, System.chars, System.Text.UTF8Encoding.GetBytesCommon(), System.ThrowHelper.ThrowArgumentNullException(), and System.ThrowHelper.ThrowArgumentOutOfRangeException().