diff options
Diffstat (limited to 'src/mscorlib/shared/System/Text/Decoder.cs')
-rw-r--r-- | src/mscorlib/shared/System/Text/Decoder.cs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/mscorlib/shared/System/Text/Decoder.cs b/src/mscorlib/shared/System/Text/Decoder.cs index f109f3db49..82d33d518c 100644 --- a/src/mscorlib/shared/System/Text/Decoder.cs +++ b/src/mscorlib/shared/System/Text/Decoder.cs @@ -134,6 +134,14 @@ namespace System.Text 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 @@ -220,6 +228,15 @@ namespace System.Text 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 @@ -326,5 +343,14 @@ namespace System.Text // 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); + } + } } } |