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

◆ GetBytes() [4/9]

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

Definition at line 323 of file UTF7Encoding.cs.

324 {
325 if (chars == null || bytes == null)
326 {
327 throw new ArgumentNullException((chars == null) ? "chars" : "bytes", SR.ArgumentNull_Array);
328 }
329 if (charIndex < 0 || charCount < 0)
330 {
331 throw new ArgumentOutOfRangeException((charIndex < 0) ? "charIndex" : "charCount", SR.ArgumentOutOfRange_NeedNonNegNum);
332 }
333 if (chars.Length - charIndex < charCount)
334 {
335 throw new ArgumentOutOfRangeException("chars", SR.ArgumentOutOfRange_IndexCountBuffer);
336 }
337 if (byteIndex < 0 || byteIndex > bytes.Length)
338 {
339 throw new ArgumentOutOfRangeException("byteIndex", SR.ArgumentOutOfRange_Index);
340 }
341 if (charCount == 0)
342 {
343 return 0;
344 }
345 int byteCount = bytes.Length - byteIndex;
346 fixed (char* ptr = chars)
347 {
348 fixed (byte* ptr2 = &MemoryMarshal.GetReference<byte>(bytes))
349 {
350 return GetBytes(ptr + charIndex, charCount, ptr2 + byteIndex, byteCount, null);
351 }
352 }
353 }
unsafe override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex)

References System.SR.ArgumentNull_Array, System.SR.ArgumentOutOfRange_Index, System.SR.ArgumentOutOfRange_IndexCountBuffer, System.SR.ArgumentOutOfRange_NeedNonNegNum, System.byteCount, System.byteIndex, System.bytes, System.charCount, System.charIndex, System.chars, and System.Text.UTF7Encoding.GetBytes().