10 [__DynamicallyInvokable]
25 [__DynamicallyInvokable]
28 [__DynamicallyInvokable]
33 [__DynamicallyInvokable]
40 if (m_fallbackBuffer !=
null && m_fallbackBuffer.
Remaining > 0)
45 m_fallbackBuffer =
null;
52 [__DynamicallyInvokable]
55 [__DynamicallyInvokable]
58 if (m_fallbackBuffer ==
null)
60 if (m_fallback !=
null)
69 return m_fallbackBuffer;
73 internal bool InternalHasFallbackBuffer => m_fallbackBuffer !=
null;
77 info.AddValue(
"m_fallback", m_fallback);
81 [__DynamicallyInvokable]
88 [__DynamicallyInvokable]
91 char[] chars =
new char[0];
92 byte[] bytes =
new byte[
GetByteCount(chars, 0, 0, flush:
true)];
93 GetBytes(chars, 0, 0, bytes, 0, flush:
true);
94 if (m_fallbackBuffer !=
null)
96 m_fallbackBuffer.
Reset();
114 [__DynamicallyInvokable]
115 public abstract int GetByteCount(
char[] chars,
int index,
int count,
bool flush);
130 [CLSCompliant(
false)]
132 public unsafe
virtual int GetByteCount(
char* chars,
int count,
bool flush)
142 char[] array =
new char[count];
143 for (
int i = 0; i < count; i++)
170 [__DynamicallyInvokable]
171 public abstract int GetBytes(
char[] chars,
int charIndex,
int charCount,
byte[] bytes,
int byteIndex,
bool flush);
191 [CLSCompliant(
false)]
193 public unsafe
virtual int GetBytes(
char* chars,
int charCount,
byte* bytes,
int byteCount,
bool flush)
195 if (bytes ==
null || chars ==
null)
199 if (charCount < 0 || byteCount < 0)
203 char[] array =
new char[charCount];
204 for (
int i = 0; i < charCount; i++)
208 byte[] array2 =
new byte[byteCount];
209 int bytes2 =
GetBytes(array, 0, charCount, array2, 0, flush);
210 if (bytes2 < byteCount)
214 for (
int i = 0; i < byteCount; i++)
216 bytes[i] = array2[i];
241 [__DynamicallyInvokable]
242 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)
244 if (chars ==
null || bytes ==
null)
248 if (charIndex < 0 || charCount < 0)
252 if (byteIndex < 0 || byteCount < 0)
256 if (chars.Length - charIndex < charCount)
260 if (bytes.Length - byteIndex < byteCount)
264 for (charsUsed = charCount; charsUsed > 0; charsUsed /= 2)
266 if (
GetByteCount(chars, charIndex, charsUsed, flush) <= byteCount)
268 bytesUsed =
GetBytes(chars, charIndex, charsUsed, bytes, byteIndex, flush);
269 completed = (charsUsed == charCount && (m_fallbackBuffer ==
null || m_fallbackBuffer.
Remaining == 0));
295 [CLSCompliant(
false)]
297 public unsafe
virtual void Convert(
char* chars,
int charCount,
byte* bytes,
int byteCount,
bool flush, out
int charsUsed, out
int bytesUsed, out
bool completed)
299 if (bytes ==
null || chars ==
null)
303 if (charCount < 0 || byteCount < 0)
307 for (charsUsed = charCount; charsUsed > 0; charsUsed /= 2)
311 bytesUsed =
GetBytes(chars, charsUsed, bytes, byteCount, flush);
312 completed = (charsUsed == charCount && (m_fallbackBuffer ==
null || m_fallbackBuffer.
Remaining == 0));
static EncoderFallback ReplacementFallback
Gets an object that outputs a substitute string in place of an input character that cannot be encoded...
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)
Converts an array of Unicode characters to an encoded byte sequence and stores the result in an array...
The exception that is thrown when a null reference (Nothing in Visual Basic) is passed to a method th...
Converts a set of characters into a sequence of bytes.
virtual unsafe int GetByteCount(char *chars, int count, bool flush)
When overridden in a derived class, calculates the number of bytes produced by encoding a set of char...
abstract int GetBytes(char[] chars, int charIndex, int charCount, byte[] bytes, int byteIndex, bool flush)
When overridden in a derived class, encodes a set of characters from the specified character array an...
The exception that is thrown when the value of an argument is outside the allowable range of values a...
abstract int Remaining
When overridden in a derived class, gets the number of characters in the current T:System....
Provides a failure-handling mechanism, called a fallback, for an input character that cannot be conve...
virtual void Reset()
Initializes all data and state information pertaining to this fallback buffer.
Provides information about, and means to manipulate, the current environment and platform....
virtual void Reset()
When overridden in a derived class, sets the encoder back to its initial state.
Stores all the data needed to serialize or deserialize an object. This class cannot be inherited.
EncoderFallbackBuffer FallbackBuffer
Gets the T:System.Text.EncoderFallbackBuffer object associated with the current T:System....
The exception that is thrown when one of the arguments provided to a method is not valid.
abstract int GetByteCount(char[] chars, int index, int count, bool flush)
When overridden in a derived class, calculates the number of bytes produced by encoding a set of char...
Encoder()
Initializes a new instance of the T:System.Text.Encoder class.
Provides a buffer that allows a fallback handler to return an alternate string to an encoder when it ...
Specifies that the class can be serialized.
abstract EncoderFallbackBuffer CreateFallbackBuffer()
When overridden in a derived class, initializes a new instance of the T:System.Text....
EncoderFallback Fallback
Gets or sets a T:System.Text.EncoderFallback object for the current T:System.Text....
virtual unsafe int GetBytes(char *chars, int charCount, byte *bytes, int byteCount, bool flush)
When overridden in a derived class, encodes a set of characters starting at the specified character p...
virtual unsafe void Convert(char *chars, int charCount, byte *bytes, int byteCount, bool flush, out int charsUsed, out int bytesUsed, out bool completed)
Converts a buffer of Unicode characters to an encoded byte sequence and stores the result in another ...