public virtual int compareTo (Charset charset) { return this.canonicalName.CompareTo (charset.canonicalName); }
public static byte[] GetBytesForString (string str, Charset charset) { MonoCharset mono_set = (MonoCharset)charset; return mono_set.Encoding.GetBytes (str); }
public static string GetStringForBytes (byte[] buffer, int offset, int count, Charset charset) { MonoCharset mono_set = (MonoCharset)charset; return mono_set.Encoding.GetString (buffer, offset, count); }
public static string GetStringForBytes (byte[] buffer, Charset charset) { return GetStringForBytes (buffer, 0, buffer.Length, charset); }
public override bool contains (Charset charset) { return charset == this; }
/// <summary> /// Initializes a new encoder. The new encoder will have the given /// bytes-per-char values and its replacement will be the /// byte array <tt>{</tt> <tt>(byte)'?'</tt> <tt>}</tt>. /// </summary> /// <param name="cs"> /// The charset that created this encoder /// </param> /// <param name="averageBytesPerChar"> /// A positive float value indicating the expected number of /// bytes that will be produced for each input character /// </param> /// <param name="maxBytesPerChar"> /// A positive float value indicating the maximum number of /// bytes that will be produced for each input character /// </param> /// <exception cref="IllegalArgumentException"> /// If the preconditions on the parameters do not hold </exception> protected internal CharsetEncoder(Charset cs, float averageBytesPerChar, float maxBytesPerChar) : this(cs, averageBytesPerChar, maxBytesPerChar, new sbyte[] { (sbyte)'?' }) { }