return GetCharCount(arrbyte, 0, count);
}
+ public virtual unsafe int GetCharCount(ReadOnlySpan<byte> bytes, bool flush)
+ {
+ fixed (byte* bytesPtr = &bytes.DangerousGetPinnableReference())
+ {
+ return GetCharCount(bytesPtr, bytes.Length, flush);
+ }
+ }
+
// Decodes a range of bytes in a byte array into a range of characters
// in a character array. The method decodes byteCount bytes from
// bytes starting at index byteIndex, storing the resulting
return charCount;
}
+ public virtual unsafe int GetChars(ReadOnlySpan<byte> bytes, Span<char> chars, bool flush)
+ {
+ fixed (byte* bytesPtr = &bytes.DangerousGetPinnableReference())
+ fixed (char* charsPtr = &chars.DangerousGetPinnableReference())
+ {
+ return GetChars(bytesPtr, bytes.Length, charsPtr, chars.Length, flush);
+ }
+ }
+
// This method is used when the output buffer might not be large enough.
// It will decode until it runs out of bytes, and then it will return
// true if it the entire input was converted. In either case it
// Oops, we didn't have anything, we'll have to throw an overflow
throw new ArgumentException(SR.Argument_ConversionOverflow);
}
+
+ public virtual unsafe void Convert(ReadOnlySpan<byte> bytes, Span<char> chars, bool flush, out int bytesUsed, out int charsUsed, out bool completed)
+ {
+ fixed (byte* bytesPtr = &bytes.DangerousGetPinnableReference())
+ fixed (char* charsPtr = &chars.DangerousGetPinnableReference())
+ {
+ Convert(bytesPtr, bytes.Length, charsPtr, chars.Length, flush, out bytesUsed, out charsUsed, out completed);
+ }
+ }
}
}
return GetByteCount(arrChar, 0, count, flush);
}
+ public virtual unsafe int GetByteCount(ReadOnlySpan<char> chars, bool flush)
+ {
+ fixed (char* charsPtr = &chars.DangerousGetPinnableReference())
+ {
+ return GetByteCount(charsPtr, chars.Length, flush);
+ }
+ }
+
// Encodes a range of characters in a character array into a range of bytes
// in a byte array. The method encodes charCount characters from
// chars starting at index charIndex, storing the resulting
return byteCount;
}
+ public virtual unsafe int GetBytes(ReadOnlySpan<char> chars, Span<byte> bytes, bool flush)
+ {
+ fixed (char* charsPtr = &chars.DangerousGetPinnableReference())
+ fixed (byte* bytesPtr = &bytes.DangerousGetPinnableReference())
+ {
+ return GetBytes(charsPtr, chars.Length, bytesPtr, bytes.Length, flush);
+ }
+ }
+
// This method is used to avoid running out of output buffer space.
// It will encode until it runs out of chars, and then it will return
// true if it the entire input was converted. In either case it
// Oops, we didn't have anything, we'll have to throw an overflow
throw new ArgumentException(SR.Argument_ConversionOverflow);
}
+
+ public virtual unsafe void Convert(ReadOnlySpan<char> chars, Span<byte> bytes, bool flush, out int charsUsed, out int bytesUsed, out bool completed)
+ {
+ fixed (char* charsPtr = &chars.DangerousGetPinnableReference())
+ fixed (byte* bytesPtr = &bytes.DangerousGetPinnableReference())
+ {
+ Convert(charsPtr, chars.Length, bytesPtr, bytes.Length, flush, out charsUsed, out bytesUsed, out completed);
+ }
+ }
}
}