本文整理汇总了C#中System.Text.ASCIIEncoding.GetDecoder方法的典型用法代码示例。如果您正苦于以下问题:C# ASCIIEncoding.GetDecoder方法的具体用法?C# ASCIIEncoding.GetDecoder怎么用?C# ASCIIEncoding.GetDecoder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Text.ASCIIEncoding
的用法示例。
在下文中一共展示了ASCIIEncoding.GetDecoder方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: base64Decode
public string base64Decode(string data)
{
try
{
System.Text.Encoding encoder = null;
switch (m_Format)
{
case Formats.UNICODE:
encoder = new System.Text.UnicodeEncoding(); break;
case Formats.UTF7:
encoder = new System.Text.UTF7Encoding(); break;
case Formats.UTF8:
encoder = new System.Text.UTF8Encoding(); break;
case Formats.UTF32:
encoder = new System.Text.UTF32Encoding(); break;
case Formats.ASCII:
default:
encoder = new System.Text.ASCIIEncoding(); break;
}
System.Text.Decoder decoder = encoder.GetDecoder();
// System.Text.UTF8Encoding encoder = new System.Text.UTF8Encoding();
// System.Text.Decoder utf8Decode = encoder.GetDecoder();
byte[] todecode_byte = Convert.FromBase64String(data);
int charCount = decoder.GetCharCount(todecode_byte, 0, todecode_byte.Length);
char[] decoded_char = new char[charCount];
decoder.GetChars(todecode_byte, 0, todecode_byte.Length, decoded_char, 0);
string result = new String(decoded_char);
return result;
}
catch (Exception e)
{
throw new Exception("Error in base64Decode: " + e.Message);
}
}
示例2: getFileName
public string getFileName()
{
char [] charBuf = new char[6];
ASCIIEncoding ae = new ASCIIEncoding();
Decoder d = ae.GetDecoder();
d.GetChars( m_FileName, 0, 6, charBuf, 0 );
return new string( charBuf );
}
示例3: getTypeface
public string getTypeface()
{
char [] charBuf = new char[16];
ASCIIEncoding ae = new ASCIIEncoding();
Decoder d = ae.GetDecoder();
d.GetChars( m_Typeface, 0, 6, charBuf, 0 );
return new string( charBuf );
}
示例4: getCharacterComplement
public string getCharacterComplement()
{
char [] charBuf = new char[8];
ASCIIEncoding ae = new ASCIIEncoding();
Decoder d = ae.GetDecoder();
d.GetChars( m_CharacterComplement, 0, 8, charBuf, 0 );
return new string( charBuf );
}