diff options
Diffstat (limited to 'mcs/class/I18N/Common/ByteEncoding.cs')
-rw-r--r-- | mcs/class/I18N/Common/ByteEncoding.cs | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/mcs/class/I18N/Common/ByteEncoding.cs b/mcs/class/I18N/Common/ByteEncoding.cs index 463e30b1132..52fe6a9bf4e 100644 --- a/mcs/class/I18N/Common/ByteEncoding.cs +++ b/mcs/class/I18N/Common/ByteEncoding.cs @@ -76,6 +76,27 @@ public abstract class ByteEncoding : MonoEncoding } #endif + // Get the number of bytes needed to encode a character buffer. + public override int GetByteCount(char[] chars, int index, int count) + { + if(chars == null) + { + throw new ArgumentNullException("chars"); + } + if(index < 0 || index > chars.Length) + { + throw new ArgumentOutOfRangeException + ("index", Strings.GetString("ArgRange_Array")); + } + if(count < 0 || count > (chars.Length - index)) + { + throw new ArgumentOutOfRangeException + ("count", Strings.GetString("ArgRange_Array")); + } + return count; + } + + // Convenience wrappers for "GetByteCount". public override int GetByteCount(String s) { if(s == null) @@ -85,12 +106,6 @@ public abstract class ByteEncoding : MonoEncoding return s.Length; } - // Get the number of bytes needed to encode a character buffer. - public unsafe override int GetByteCountImpl (char* chars, int count) - { - return count; - } - // Convert an array of characters into a byte buffer, // once the parameters have been validated. protected unsafe abstract void ToBytes ( |