<Type Name="Encoder" FullName="System.Text.Encoder" FullNameSP="System_Text_Encoder" Maintainer="ecma">
  <TypeSignature Language="ILASM" Value=".class public abstract serializable Encoder extends System.Object" />
  <TypeSignature Language="C#" Value="public abstract class Encoder" />
  <MemberOfLibrary>BCL</MemberOfLibrary>
  <AssemblyInfo>
    <AssemblyName>mscorlib</AssemblyName>
    <AssemblyPublicKey>[00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 ]</AssemblyPublicKey>
    <AssemblyVersion>1.0.5000.0</AssemblyVersion>
    <AssemblyVersion>2.0.0.0</AssemblyVersion>
    <AssemblyVersion>4.0.0.0</AssemblyVersion>
  </AssemblyInfo>
  <ThreadingSafetyStatement>All public static members of this type are safe for multithreaded operations. No instance members are guaranteed to be thread safe.</ThreadingSafetyStatement>
  <Base>
    <BaseTypeName>System.Object</BaseTypeName>
  </Base>
  <Interfaces />
  <Docs>
    <summary>
      <para> Converts blocks of characters into blocks of bytes. </para>
    </summary>
    <remarks>
      <para>
        <block subset="none" type="note">Following instantiation of a <see cref="T:System.Text.Encoder" />, sequential
   blocks of characters are converted into blocks of bytes through calls to the
<see cref="M:System.Text.Encoder.GetBytes(System.Char[],System.Int32,System.Int32,System.Byte[],System.Int32,System.Boolean)" /> method. The encoder maintains state between the 
   conversions, allowing it to correctly encode character sequences that span
   adjacent blocks. An instance of a specific implementation of the
<see cref="T:System.Text.Encoder" />
class is typically obtained
through a call to the <see cref="M:System.Text.Encoding.GetEncoder" /> .</block>
      </para>
    </remarks>
    <example>
      <para>The following example demonstrates using the <see cref="T:System.Text.UTF8Encoding" /> class to convert one character array to two byte
arrays.</para>
      <code lang="C#">using System;
using System.Text;

public class EncoderExample
{

   public static void Main()
   {

      string str = "Encoder";
      char[] cAry = str.ToCharArray();
      UTF8Encoding utf = new UTF8Encoding();
    
      Encoder e = utf.GetEncoder();
      int count1 = 
         e.GetByteCount(cAry,0,cAry.Length-4,false);
      int count2 = 
         e.GetByteCount(cAry,cAry.Length-4,4,true);
      byte[] bytes1 = new byte[count1];
      byte[] bytes2 = new byte[count2];
      
      e.GetBytes(cAry,0,cAry.Length-4,bytes1,0,false);
      e.GetBytes(cAry,cAry.Length-4,4,bytes2,0,true);

      Console.Write("Bytes1: ");
      foreach (byte b in bytes1)
         Console.Write(" '{0}' ", b);
      Console.WriteLine();

      Console.Write("Bytes2: ");
      foreach (byte b in bytes2)
         Console.Write(" '{0}' ", b);
      Console.WriteLine();
            
   }

}
</code>
      <para>The output is</para>
      <c>
        <para>Bytes1: '69' '110' '99' </para>
        <para>Bytes2: '111' '100' '101' '114'</para>
      </c>
    </example>
  </Docs>
  <Members>
    <Member MemberName=".ctor">
      <MemberSignature Language="ILASM" Value="family rtspecialname specialname instance void .ctor()" />
      <MemberSignature Language="C#" Value="protected Encoder ();" />
      <MemberType>Constructor</MemberType>
      <ReturnValue />
      <Parameters />
      <Docs>
        <summary>
          <para> Constructs a new instance of the <see cref="T:System.Text.Encoder" /> class.
   </para>
        </summary>
        <remarks>
          <para>This constructor is called only by classes that inherit from the <see cref="T:System.Text.Encoder" /> class.</para>
        </remarks>
      </Docs>
      <Excluded>0</Excluded>
      <AssemblyInfo>
        <AssemblyVersion>1.0.5000.0</AssemblyVersion>
        <AssemblyVersion>2.0.0.0</AssemblyVersion>
        <AssemblyVersion>4.0.0.0</AssemblyVersion>
      </AssemblyInfo>
    </Member>
    <Member MemberName="Convert">
      <MemberSignature Language="C#" Value="public virtual void Convert (char* chars, int charCount, byte* bytes, int byteCount, bool flush, out int charsUsed, out int bytesUsed, out bool completed);" />
      <MemberType>Method</MemberType>
      <ReturnValue>
        <ReturnType>System.Void</ReturnType>
      </ReturnValue>
      <Parameters>
        <Parameter Name="chars" Type="System.Char*" />
        <Parameter Name="charCount" Type="System.Int32" />
        <Parameter Name="bytes" Type="System.Byte*" />
        <Parameter Name="byteCount" Type="System.Int32" />
        <Parameter Name="flush" Type="System.Boolean" />
        <Parameter Name="charsUsed" Type="System.Int32&amp;" RefType="out" />
        <Parameter Name="bytesUsed" Type="System.Int32&amp;" RefType="out" />
        <Parameter Name="completed" Type="System.Boolean&amp;" RefType="out" />
      </Parameters>
      <Docs>
        <param name="chars">To be added.</param>
        <param name="charCount">To be added.</param>
        <param name="bytes">To be added.</param>
        <param name="byteCount">To be added.</param>
        <param name="flush">To be added.</param>
        <param name="charsUsed">To be added.</param>
        <param name="bytesUsed">To be added.</param>
        <param name="completed">To be added.</param>
        <summary>To be added.</summary>
        <remarks>To be added.</remarks>
        <since version=".NET 2.0" />
      </Docs>
      <AssemblyInfo>
        <AssemblyVersion>2.0.0.0</AssemblyVersion>
        <AssemblyVersion>4.0.0.0</AssemblyVersion>
      </AssemblyInfo>
      <Attributes>
        <Attribute>
          <AttributeName>System.CLSCompliant(false)</AttributeName>
        </Attribute>
        <Attribute>
          <AttributeName>System.Runtime.InteropServices.ComVisible(false)</AttributeName>
        </Attribute>
      </Attributes>
    </Member>
    <Member MemberName="Convert">
      <MemberSignature Language="C#" Value="public virtual void Convert (char[] chars, int charIndex, int charCount, byte[] bytes, int byteIndex, int byteCount, bool flush, out int charsUsed, out int bytesUsed, out bool completed);" />
      <MemberType>Method</MemberType>
      <ReturnValue>
        <ReturnType>System.Void</ReturnType>
      </ReturnValue>
      <Parameters>
        <Parameter Name="chars" Type="System.Char[]" />
        <Parameter Name="charIndex" Type="System.Int32" />
        <Parameter Name="charCount" Type="System.Int32" />
        <Parameter Name="bytes" Type="System.Byte[]" />
        <Parameter Name="byteIndex" Type="System.Int32" />
        <Parameter Name="byteCount" Type="System.Int32" />
        <Parameter Name="flush" Type="System.Boolean" />
        <Parameter Name="charsUsed" Type="System.Int32&amp;" RefType="out" />
        <Parameter Name="bytesUsed" Type="System.Int32&amp;" RefType="out" />
        <Parameter Name="completed" Type="System.Boolean&amp;" RefType="out" />
      </Parameters>
      <Docs>
        <param name="chars">To be added.</param>
        <param name="charIndex">To be added.</param>
        <param name="charCount">To be added.</param>
        <param name="bytes">To be added.</param>
        <param name="byteIndex">To be added.</param>
        <param name="byteCount">To be added.</param>
        <param name="flush">To be added.</param>
        <param name="charsUsed">To be added.</param>
        <param name="bytesUsed">To be added.</param>
        <param name="completed">To be added.</param>
        <summary>To be added.</summary>
        <remarks>To be added.</remarks>
        <since version=".NET 2.0" />
      </Docs>
      <AssemblyInfo>
        <AssemblyVersion>2.0.0.0</AssemblyVersion>
        <AssemblyVersion>4.0.0.0</AssemblyVersion>
      </AssemblyInfo>
      <Attributes>
        <Attribute>
          <AttributeName>System.Runtime.InteropServices.ComVisible(false)</AttributeName>
        </Attribute>
      </Attributes>
    </Member>
    <Member MemberName="Fallback">
      <MemberSignature Language="C#" Value="public System.Text.EncoderFallback Fallback { set; get; }" />
      <MemberType>Property</MemberType>
      <Attributes>
        <Attribute>
          <AttributeName>System.Runtime.InteropServices.ComVisible(false)</AttributeName>
        </Attribute>
      </Attributes>
      <ReturnValue>
        <ReturnType>System.Text.EncoderFallback</ReturnType>
      </ReturnValue>
      <Docs>
        <summary>To be added.</summary>
        <value>To be added.</value>
        <remarks>To be added.</remarks>
        <since version=".NET 2.0" />
      </Docs>
      <AssemblyInfo>
        <AssemblyVersion>2.0.0.0</AssemblyVersion>
        <AssemblyVersion>4.0.0.0</AssemblyVersion>
      </AssemblyInfo>
    </Member>
    <Member MemberName="FallbackBuffer">
      <MemberSignature Language="C#" Value="public System.Text.EncoderFallbackBuffer FallbackBuffer { get; }" />
      <MemberType>Property</MemberType>
      <Attributes>
        <Attribute>
          <AttributeName>System.Runtime.InteropServices.ComVisible(false)</AttributeName>
        </Attribute>
      </Attributes>
      <ReturnValue>
        <ReturnType>System.Text.EncoderFallbackBuffer</ReturnType>
      </ReturnValue>
      <Docs>
        <summary>To be added.</summary>
        <value>To be added.</value>
        <remarks>To be added.</remarks>
        <since version=".NET 2.0" />
      </Docs>
      <AssemblyInfo>
        <AssemblyVersion>2.0.0.0</AssemblyVersion>
        <AssemblyVersion>4.0.0.0</AssemblyVersion>
      </AssemblyInfo>
    </Member>
    <Member MemberName="GetByteCount">
      <MemberSignature Language="C#" Value="public virtual int GetByteCount (char* chars, int count, bool flush);" />
      <MemberType>Method</MemberType>
      <ReturnValue>
        <ReturnType>System.Int32</ReturnType>
      </ReturnValue>
      <Parameters>
        <Parameter Name="chars" Type="System.Char*" />
        <Parameter Name="count" Type="System.Int32" />
        <Parameter Name="flush" Type="System.Boolean" />
      </Parameters>
      <Docs>
        <param name="chars">To be added.</param>
        <param name="count">To be added.</param>
        <param name="flush">To be added.</param>
        <summary>To be added.</summary>
        <returns>To be added.</returns>
        <remarks>To be added.</remarks>
        <since version=".NET 2.0" />
      </Docs>
      <AssemblyInfo>
        <AssemblyVersion>2.0.0.0</AssemblyVersion>
        <AssemblyVersion>4.0.0.0</AssemblyVersion>
      </AssemblyInfo>
      <Attributes>
        <Attribute>
          <AttributeName>System.CLSCompliant(false)</AttributeName>
        </Attribute>
        <Attribute>
          <AttributeName>System.Runtime.InteropServices.ComVisible(false)</AttributeName>
        </Attribute>
      </Attributes>
    </Member>
    <Member MemberName="GetByteCount">
      <MemberSignature Language="ILASM" Value=".method public hidebysig virtual abstract int32 GetByteCount(class System.Char[] chars, int32 index, int32 count, bool flush)" />
      <MemberSignature Language="C#" Value="public abstract int GetByteCount (char[] chars, int index, int count, bool flush);" />
      <MemberType>Method</MemberType>
      <ReturnValue>
        <ReturnType>System.Int32</ReturnType>
      </ReturnValue>
      <Parameters>
        <Parameter Name="chars" Type="System.Char[]" />
        <Parameter Name="index" Type="System.Int32" />
        <Parameter Name="count" Type="System.Int32" />
        <Parameter Name="flush" Type="System.Boolean" />
      </Parameters>
      <Docs>
        <param name="chars">A <see cref="T:System.Char" /> array of characters to encode. </param>
        <param name="index">A <see cref="T:System.Int32" /> that specifies the first index of <paramref name="chars" /> to encode. </param>
        <param name="count">A <see cref="T:System.Int32" /> that specifies the number of elements in <paramref name="chars" /> to encode. </param>
        <param name="flush">A <see cref="T:System.Boolean" /> value that determines whether the current instance flushes its internal state following a conversion. Specify <see langword="true" /> to flush the internal state of the current instance following a conversion; otherwise, specify <see langword="false" /> . </param>
        <summary>
          <para> Determines the exact number of bytes required to
      encode the specified range in the specified array of
      
      characters.
      </para>
        </summary>
        <returns>
          <para>A <see cref="T:System.Int32" /> containing the
   number of bytes required to encode the range in <paramref name="chars" /> from
<paramref name="index" /> to 
<paramref name=" index" />
+ <paramref name="count" /> -1 for a particular encoding.</para>
          <para>
            <block subset="none" type="note">This value takes
   into account the state in which the current instance was left following the last
   call to <see cref="M:System.Text.Encoder.GetBytes(System.Char[],System.Int32,System.Int32,System.Byte[],System.Int32,System.Boolean)" />
   .</block>
          </para>
        </returns>
        <remarks>
          <para> The state of the current instance is not affected by a call to this
      method.
      </para>
          <para>
            <block subset="none" type="behaviors">As described
      above.</block>
          </para>
          <para>
            <block subset="none" type="overrides">Override this
   method to retrieve the exact number of bytes required to encode a
   specified range of an array of <see cref="T:System.Char" /> objects
   for a particular encoding.</block>
          </para>
          <para>
            <block subset="none" type="usage">Use this method to determine the
   exact number of bytes required to encode the specified range of an array
   of <see cref="T:System.Char" /> objects for a particular
   encoding.</block>
          </para>
        </remarks>
        <exception cref="T:System.ArgumentNullException">
          <paramref name="chars " /> is <see langword="null" />. </exception>
        <exception cref="T:System.ArgumentOutOfRangeException">
          <para>Return value is greater than <see cref="F:System.Int32.MaxValue" />. </para>
          <para>-or- </para>
          <para>
            <paramref name="index" /> &lt; 0. </para>
          <para> -or- </para>
          <para>
            <paramref name="count" /> &lt; 0. </para>
          <para> -or- </para>
          <para>
            <paramref name="index" /> and <paramref name="count" /> do not specify a valid range in <paramref name="chars" /> (i.e. (<paramref name="index" /> + <paramref name="count" />) &gt; <paramref name="chars" />.Length).</para>
        </exception>
      </Docs>
      <Excluded>0</Excluded>
      <AssemblyInfo>
        <AssemblyVersion>1.0.5000.0</AssemblyVersion>
        <AssemblyVersion>2.0.0.0</AssemblyVersion>
        <AssemblyVersion>4.0.0.0</AssemblyVersion>
      </AssemblyInfo>
    </Member>
    <Member MemberName="GetBytes">
      <MemberSignature Language="C#" Value="public virtual int GetBytes (char* chars, int charCount, byte* bytes, int byteCount, bool flush);" />
      <MemberType>Method</MemberType>
      <ReturnValue>
        <ReturnType>System.Int32</ReturnType>
      </ReturnValue>
      <Parameters>
        <Parameter Name="chars" Type="System.Char*" />
        <Parameter Name="charCount" Type="System.Int32" />
        <Parameter Name="bytes" Type="System.Byte*" />
        <Parameter Name="byteCount" Type="System.Int32" />
        <Parameter Name="flush" Type="System.Boolean" />
      </Parameters>
      <Docs>
        <param name="chars">To be added.</param>
        <param name="charCount">To be added.</param>
        <param name="bytes">To be added.</param>
        <param name="byteCount">To be added.</param>
        <param name="flush">To be added.</param>
        <summary>To be added.</summary>
        <returns>To be added.</returns>
        <remarks>To be added.</remarks>
        <since version=".NET 2.0" />
      </Docs>
      <AssemblyInfo>
        <AssemblyVersion>2.0.0.0</AssemblyVersion>
        <AssemblyVersion>4.0.0.0</AssemblyVersion>
      </AssemblyInfo>
      <Attributes>
        <Attribute>
          <AttributeName>System.CLSCompliant(false)</AttributeName>
        </Attribute>
        <Attribute>
          <AttributeName>System.Runtime.InteropServices.ComVisible(false)</AttributeName>
        </Attribute>
      </Attributes>
    </Member>
    <Member MemberName="GetBytes">
      <MemberSignature Language="ILASM" Value=".method public hidebysig virtual abstract int32 GetBytes(class System.Char[] chars, int32 charIndex, int32 charCount, class System.Byte[] bytes, int32 byteIndex, bool flush)" />
      <MemberSignature Language="C#" Value="public abstract int GetBytes (char[] chars, int charIndex, int charCount, byte[] bytes, int byteIndex, bool flush);" />
      <MemberType>Method</MemberType>
      <ReturnValue>
        <ReturnType>System.Int32</ReturnType>
      </ReturnValue>
      <Parameters>
        <Parameter Name="chars" Type="System.Char[]" />
        <Parameter Name="charIndex" Type="System.Int32" />
        <Parameter Name="charCount" Type="System.Int32" />
        <Parameter Name="bytes" Type="System.Byte[]" />
        <Parameter Name="byteIndex" Type="System.Int32" />
        <Parameter Name="flush" Type="System.Boolean" />
      </Parameters>
      <Docs>
        <param name="chars">A <see cref="T:System.Char" /> array of characters to encode. </param>
        <param name="charIndex">A <see cref="T:System.Int32" /> that specifies the first index of <paramref name="chars" /> to encode. </param>
        <param name="charCount">A <see cref="T:System.Int32" /> that specifies the number of elements in <paramref name="chars" /> to encode. </param>
        <param name="bytes">A <see cref="T:System.Byte" /> array to encode into. </param>
        <param name="byteIndex">A <see cref="T:System.Int32" /> that specifies the first index of <paramref name="bytes" /> to encode into. </param>
        <param name="flush">
          <para>A <see cref="T:System.Boolean" /> value. Specify <see langword="true" /> to flush the internal state of the current instance following a conversion; otherwise, specify <see langword="false" /> . <block subset="none" type="note">To ensure correct termination of a sequence of blocks of encoded bytes, it is recommended that the last call to <see cref="M:System.Text.Encoder.GetBytes(System.Char[],System.Int32,System.Int32,System.Byte[],System.Int32,System.Boolean)" /> specify <see langword="true" /> .</block></para>
        </param>
        <summary>
          <para> Encodes the specified range of the specified array
      of characters into the specified range of the specified array of bytes. </para>
        </summary>
        <returns>
          <para> A <see cref="T:System.Int32" /> containing the number of bytes encoded into <paramref name="bytes" /> for a
   particular encoding.
   </para>
        </returns>
        <remarks>
          <para>The encoding takes into account the state in which the
      current instance was left following the last call to this method if
   <paramref name="flush" /> was specified as <see langword="true" />
   for that call.</para>
          <para>
            <block subset="none" type="behaviors">As described above.</block>
          </para>
          <para>
            <block subset="none" type="overrides">Override
   this method to encode the values of an array of <see cref="T:System.Char" /> objects as an array of <see cref="T:System.Byte" /> objects for a particular
   encoding.</block>
          </para>
          <para>
            <block subset="none" type="usage">Use this method to encode the values of an array
   of <see cref="T:System.Char" /> objects as an array
   of <see cref="T:System.Byte" />
   objects for a particular encoding.</block>
          </para>
        </remarks>
        <exception cref="T:System.ArgumentException">
          <para>
            <paramref name="bytes" /> does not contain sufficient space to store the encoded characters.</para>
        </exception>
        <exception cref="T:System.ArgumentNullException">
          <para>
            <paramref name="chars " />is <see langword="null" /> . </para>
          <para>-or- </para>
          <para>
            <paramref name="bytes " />is <see langword="null" /> . </para>
        </exception>
        <exception cref="T:System.ArgumentOutOfRangeException">
          <para>
            <paramref name="charIndex" /> &lt; 0. </para>
          <para> -or- </para>
          <para>
            <paramref name="charCount " /> &lt; 0. </para>
          <para> -or- </para>
          <para>
            <paramref name="byteIndex " /> &lt; 0. </para>
          <para> -or- </para>
          <para>(<paramref name="chars" />.Length - <paramref name="charIndex" />) &lt; <paramref name="charCount" />.</para>
          <para>-or-</para>
          <para>
            <paramref name="byteIndex" /> &gt; <paramref name="bytes" />.Length.</para>
        </exception>
      </Docs>
      <Excluded>0</Excluded>
      <AssemblyInfo>
        <AssemblyVersion>1.0.5000.0</AssemblyVersion>
        <AssemblyVersion>2.0.0.0</AssemblyVersion>
        <AssemblyVersion>4.0.0.0</AssemblyVersion>
      </AssemblyInfo>
    </Member>
    <Member MemberName="Reset">
      <MemberSignature Language="C#" Value="public virtual void Reset ();" />
      <MemberType>Method</MemberType>
      <ReturnValue>
        <ReturnType>System.Void</ReturnType>
      </ReturnValue>
      <Parameters />
      <Docs>
        <summary>To be added.</summary>
        <remarks>To be added.</remarks>
        <since version=".NET 2.0" />
      </Docs>
      <AssemblyInfo>
        <AssemblyVersion>2.0.0.0</AssemblyVersion>
        <AssemblyVersion>4.0.0.0</AssemblyVersion>
      </AssemblyInfo>
      <Attributes>
        <Attribute>
          <AttributeName>System.Runtime.InteropServices.ComVisible(false)</AttributeName>
        </Attribute>
      </Attributes>
    </Member>
  </Members>
  <TypeExcluded>0</TypeExcluded>
  <Attributes>
    <Attribute>
      <AttributeName>System.Runtime.InteropServices.ComVisible(true)</AttributeName>
    </Attribute>
  </Attributes>
</Type>
