Пример #1
0
 /// <summary>Converts a range of bytes in a byte array from one encoding to another.</summary>
 /// <returns>An array of type <see cref="T:System.Byte" /> containing the result of converting a range of bytes in <paramref name="bytes" /> from <paramref name="srcEncoding" /> to <paramref name="dstEncoding" />.</returns>
 /// <param name="srcEncoding">The encoding of the source array, <paramref name="bytes" />. </param>
 /// <param name="dstEncoding">The encoding of the output array. </param>
 /// <param name="bytes">The array of bytes to convert. </param>
 /// <param name="index">The index of the first element of <paramref name="bytes" /> to convert. </param>
 /// <param name="count">The number of bytes to convert. </param>
 /// <exception cref="T:System.ArgumentNullException">
 /// <paramref name="srcEncoding" /> is null.-or- <paramref name="dstEncoding" /> is null.-or- <paramref name="bytes" /> is null. </exception>
 /// <exception cref="T:System.ArgumentOutOfRangeException">
 /// <paramref name="index" /> and <paramref name="count" /> do not specify a valid range in the byte array. </exception>
 /// <exception cref="T:System.Text.DecoderFallbackException">A fallback occurred (see Character Encoding in the .NET Framework for complete explanation)-and-srcEncoding.<see cref="P:System.Text.Encoding.DecoderFallback" /> is set to <see cref="T:System.Text.DecoderExceptionFallback" />.</exception>
 /// <exception cref="T:System.Text.EncoderFallbackException">A fallback occurred (see Character Encoding in the .NET Framework for complete explanation)-and-dstEncoding.<see cref="P:System.Text.Encoding.EncoderFallback" /> is set to <see cref="T:System.Text.EncoderExceptionFallback" />.</exception>
 public byte[] Convert(IEncoding srcEncoding, IEncoding dstEncoding, byte[] bytes, int index, int count)
 {
     return(EncodingAdapter.Convert(srcEncoding, dstEncoding, bytes, index, count));
 }
Пример #2
0
 /// <summary>Converts an entire byte array from one encoding to another.</summary>
 /// <returns>An array of type <see cref="T:System.Byte" /> containing the results of converting <paramref name="bytes" /> from <paramref name="srcEncoding" /> to <paramref name="dstEncoding" />.</returns>
 /// <param name="srcEncoding">The encoding format of <paramref name="bytes" />. </param>
 /// <param name="dstEncoding">The target encoding format. </param>
 /// <param name="bytes">The bytes to convert. </param>
 /// <exception cref="T:System.ArgumentNullException">
 /// <paramref name="srcEncoding" /> is null.-or- <paramref name="dstEncoding" /> is null.-or- <paramref name="bytes" /> is null. </exception>
 /// <exception cref="T:System.Text.DecoderFallbackException">A fallback occurred (see Character Encoding in the .NET Framework for complete explanation)-and-srcEncoding.<see cref="P:System.Text.Encoding.DecoderFallback" /> is set to <see cref="T:System.Text.DecoderExceptionFallback" />.</exception>
 /// <exception cref="T:System.Text.EncoderFallbackException">A fallback occurred (see Character Encoding in the .NET Framework for complete explanation)-and-dstEncoding.<see cref="P:System.Text.Encoding.EncoderFallback" /> is set to <see cref="T:System.Text.EncoderExceptionFallback" />.</exception>
 public byte[] Convert(Encoding srcEncoding, Encoding dstEncoding, byte[] bytes)
 {
     return(EncodingAdapter.Convert(srcEncoding, dstEncoding, bytes));
 }