mscorlib(4.0.0.0) API with additions
DecoderExceptionFallbackBuffer.cs
2 
3 namespace System.Text
4 {
7  {
10  public override int Remaining => 0;
11 
17  public override bool Fallback(byte[] bytesUnknown, int index)
18  {
19  Throw(bytesUnknown, index);
20  return true;
21  }
22 
25  public override char GetNextChar()
26  {
27  return '\0';
28  }
29 
32  public override bool MovePrevious()
33  {
34  return false;
35  }
36 
37  private void Throw(byte[] bytesUnknown, int index)
38  {
39  StringBuilder stringBuilder = new StringBuilder(bytesUnknown.Length * 3);
40  int i;
41  for (i = 0; i < bytesUnknown.Length && i < 20; i++)
42  {
43  stringBuilder.Append("[");
44  stringBuilder.Append(bytesUnknown[i].ToString("X2", CultureInfo.InvariantCulture));
45  stringBuilder.Append("]");
46  }
47  if (i == 20)
48  {
49  stringBuilder.Append(" ...");
50  }
51  throw new DecoderFallbackException(Environment.GetResourceString("Argument_InvalidCodePageBytesIndex", stringBuilder, index), bytesUnknown, index);
52  }
53  }
54 }
static CultureInfo InvariantCulture
Gets the T:System.Globalization.CultureInfo object that is culture-independent (invariant).
Definition: CultureInfo.cs:263
Definition: __Canon.cs:3
Throws T:System.Text.DecoderFallbackException when an encoded input byte sequence cannot be converted...
StringBuilder Append(char value, int repeatCount)
Appends a specified number of copies of the string representation of a Unicode character to this inst...
Provides a buffer that allows a fallback handler to return an alternate string to a decoder when it c...
override bool MovePrevious()
Causes the next call to M:System.Text.DecoderExceptionFallbackBuffer.GetNextChar to access the except...
Represents a mutable string of characters. This class cannot be inherited.To browse the ....
override int Remaining
Gets the number of characters in the current T:System.Text.DecoderExceptionFallbackBuffer object that...
override bool Fallback(byte[] bytesUnknown, int index)
Throws T:System.Text.DecoderFallbackException when the input byte sequence cannot be decoded....
override char GetNextChar()
Retrieves the next character in the exception data buffer.
Provides information about a specific culture (called a locale for unmanaged code development)....
Definition: CultureInfo.cs:16