Example #1
0
 public static byte[] ToBytes(string value)
 {
     try
     {
         return(UTF8Encoding.GetBytes(value));
     }
     catch (DecoderFallbackException exception)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(XmlExceptionHelper.CreateEncodingException(value, exception));
     }
 }
Example #2
0
 public static int ToChars(byte[] buffer, int offset, int count, char[] chars, int charOffset)
 {
     try
     {
         return(UTF8Encoding.GetChars(buffer, offset, count, chars, charOffset));
     }
     catch (DecoderFallbackException exception)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(XmlExceptionHelper.CreateEncodingException(buffer, offset, count, exception));
     }
 }
Example #3
0
 public static string ToStringUnicode(byte[] buffer, int offset, int count)
 {
     try
     {
         return(UnicodeEncoding.GetString(buffer, offset, count));
     }
     catch (DecoderFallbackException exception)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(XmlExceptionHelper.CreateEncodingException(buffer, offset, count, exception));
     }
 }