2 // System.Text.Decoder.cs
5 // Dietmar Maurer (dietmar@ximian.com)
7 // (C) 2001 Ximian, Inc. http://www.ximian.com
13 public abstract class Decoder
18 // fixme: dont know what do do here
21 public abstract int GetCharCount (byte[] bytes, int index, int count);
23 public abstract int GetChars (byte[] bytes, int byteIndex, int byteCount,
24 char[] chars, int charIndex);
27 internal class DefaultDecoder : Decoder {
29 public Encoding encoding;
31 public DefaultDecoder (Encoding enc)
36 public override int GetCharCount (byte[] bytes, int index, int count)
38 return encoding.GetCharCount (bytes, index, count);
41 public override int GetChars (byte[] bytes, int byteIndex, int byteCount,
42 char[] chars, int charIndex)
44 return encoding.GetChars (bytes, byteIndex, byteCount, chars, charIndex);
49 internal class IConvDecoder : Decoder {
51 private IntPtr converter;
53 public IConvDecoder (string name, bool big_endian)
55 converter = Encoding.IConvNewDecoder (name, big_endian);
58 public override int GetCharCount (byte[] bytes, int index, int count)
60 return Encoding.IConvGetCharCount (converter, bytes, index, count);
63 public override int GetChars (byte[] bytes, int byteIndex, int byteCount,
64 char[] chars, int charIndex)
66 return Encoding.IConvGetChars (converter, bytes, byteIndex, byteCount,