Converts a set of characters into a sequence of bytes.
More...
Inherited by System.Text.EncoderNLS.
|
virtual void | Reset () |
| When overridden in a derived class, sets the encoder back to its initial state. More...
|
|
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 characters from the specified character array. A parameter indicates whether to clear the internal state of the encoder after the calculation. More...
|
|
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 characters starting at the specified character pointer. A parameter indicates whether to clear the internal state of the encoder after the calculation. More...
|
|
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 and any characters in the internal buffer into the specified byte array. A parameter indicates whether to clear the internal state of the encoder after the conversion. More...
|
|
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 pointer and any characters in the internal buffer into a sequence of bytes that are stored starting at the specified byte pointer. A parameter indicates whether to clear the internal state of the encoder after the conversion. More...
|
|
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 of bytes. More...
|
|
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 buffer. More...
|
|
|
| Encoder () |
| Initializes a new instance of the T:System.Text.Encoder class. More...
|
|
Converts a set of characters into a sequence of bytes.
Definition at line 11 of file Encoder.cs.
◆ Encoder()
System.Text.Encoder.Encoder |
( |
| ) |
|
|
protected |
Initializes a new instance of the T:System.Text.Encoder class.
Definition at line 82 of file Encoder.cs.
◆ Convert() [1/2]
virtual void System.Text.Encoder.Convert |
( |
char [] |
chars, |
|
|
int |
charIndex, |
|
|
int |
charCount, |
|
|
byte [] |
bytes, |
|
|
int |
byteIndex, |
|
|
int |
byteCount, |
|
|
bool |
flush, |
|
|
out int |
charsUsed, |
|
|
out int |
bytesUsed, |
|
|
out bool |
completed |
|
) |
| |
|
virtual |
Converts an array of Unicode characters to an encoded byte sequence and stores the result in an array of bytes.
- Parameters
-
chars | An array of characters to convert. |
charIndex | The first element of chars to convert. |
charCount | The number of elements of chars to convert. |
bytes | An array where the converted bytes are stored. |
byteIndex | The first element of bytes in which data is stored. |
byteCount | The maximum number of elements of bytes to use in the conversion. |
flush | true to indicate no further data is to be converted; otherwise, false . |
charsUsed | When this method returns, contains the number of characters from chars that were used in the conversion. This parameter is passed uninitialized. |
bytesUsed | When this method returns, contains the number of bytes that were produced by the conversion. This parameter is passed uninitialized. |
completed | When this method returns, contains true if all the characters specified by charCount were converted; otherwise, false . This parameter is passed uninitialized. |
- Exceptions
-
T:System.ArgumentNullException | chars or bytes is null (Nothing ). |
T:System.ArgumentOutOfRangeException | charIndex , charCount , byteIndex , or byteCount is less than zero.-or-The length of chars - charIndex is less than charCount .-or-The length of bytes - byteIndex is less than byteCount . |
T:System.ArgumentException | The output buffer is too small to contain any of the converted input. The output buffer should be greater than or equal to the size indicated by the Overload:System.Text.Encoder.GetByteCount method. |
T:System.Text.EncoderFallbackException | A fallback occurred (see Character Encoding in the .NET Framework for fuller explanation)-and- P:System.Text.Encoder.Fallback is set to T:System.Text.EncoderExceptionFallback. |
Definition at line 242 of file Encoder.cs.
◆ Convert() [2/2]
virtual unsafe void System.Text.Encoder.Convert |
( |
char * |
chars, |
|
|
int |
charCount, |
|
|
byte * |
bytes, |
|
|
int |
byteCount, |
|
|
bool |
flush, |
|
|
out int |
charsUsed, |
|
|
out int |
bytesUsed, |
|
|
out bool |
completed |
|
) |
| |
|
virtual |
Converts a buffer of Unicode characters to an encoded byte sequence and stores the result in another buffer.
- Parameters
-
chars | The address of a string of UTF-16 encoded characters to convert. |
charCount | The number of characters in chars to convert. |
bytes | The address of a buffer to store the converted bytes. |
byteCount | The maximum number of bytes in bytes to use in the conversion. |
flush | true to indicate no further data is to be converted; otherwise, false . |
charsUsed | When this method returns, contains the number of characters from chars that were used in the conversion. This parameter is passed uninitialized. |
bytesUsed | When this method returns, contains the number of bytes that were used in the conversion. This parameter is passed uninitialized. |
completed | When this method returns, contains true if all the characters specified by charCount were converted; otherwise, false . This parameter is passed uninitialized. |
- Exceptions
-
T:System.ArgumentNullException | chars or bytes is null (Nothing ). |
T:System.ArgumentOutOfRangeException | charCount or byteCount is less than zero. |
T:System.ArgumentException | The output buffer is too small to contain any of the converted input. The output buffer should be greater than or equal to the size indicated by the Overload:System.Text.Encoder.GetByteCount method. |
T:System.Text.EncoderFallbackException | A fallback occurred (see Character Encoding in the .NET Framework for fuller explanation)-and- P:System.Text.Encoder.Fallback is set to T:System.Text.EncoderExceptionFallback. |
Definition at line 297 of file Encoder.cs.
◆ GetByteCount() [1/2]
abstract int System.Text.Encoder.GetByteCount |
( |
char [] |
chars, |
|
|
int |
index, |
|
|
int |
count, |
|
|
bool |
flush |
|
) |
| |
|
pure virtual |
When overridden in a derived class, calculates the number of bytes produced by encoding a set of characters from the specified character array. A parameter indicates whether to clear the internal state of the encoder after the calculation.
- Parameters
-
chars | The character array containing the set of characters to encode. |
index | The index of the first character to encode. |
count | The number of characters to encode. |
flush | true to simulate clearing the internal state of the encoder after the calculation; otherwise, false . |
- Returns
- The number of bytes produced by encoding the specified characters and any characters in the internal buffer.
- Exceptions
-
T:System.ArgumentNullException | chars is null . |
T:System.ArgumentOutOfRangeException | index or count is less than zero.-or- index and count do not denote a valid range in chars . |
T:System.Text.EncoderFallbackException | A fallback occurred (see Character Encoding in the .NET Framework for fuller explanation)-and- P:System.Text.Encoder.Fallback is set to T:System.Text.EncoderExceptionFallback. |
◆ GetByteCount() [2/2]
virtual unsafe int System.Text.Encoder.GetByteCount |
( |
char * |
chars, |
|
|
int |
count, |
|
|
bool |
flush |
|
) |
| |
|
virtual |
When overridden in a derived class, calculates the number of bytes produced by encoding a set of characters starting at the specified character pointer. A parameter indicates whether to clear the internal state of the encoder after the calculation.
- Parameters
-
chars | A pointer to the first character to encode. |
count | The number of characters to encode. |
flush | true to simulate clearing the internal state of the encoder after the calculation; otherwise, false . |
- Returns
- The number of bytes produced by encoding the specified characters and any characters in the internal buffer.
- Exceptions
-
T:System.ArgumentNullException | chars is null (Nothing in Visual Basic .NET). |
T:System.ArgumentOutOfRangeException | count is less than zero. |
T:System.Text.EncoderFallbackException | A fallback occurred (see Character Encoding in the .NET Framework for fuller explanation)-and- P:System.Text.Encoder.Fallback is set to T:System.Text.EncoderExceptionFallback. |
Definition at line 132 of file Encoder.cs.
◆ GetBytes() [1/2]
abstract int System.Text.Encoder.GetBytes |
( |
char [] |
chars, |
|
|
int |
charIndex, |
|
|
int |
charCount, |
|
|
byte [] |
bytes, |
|
|
int |
byteIndex, |
|
|
bool |
flush |
|
) |
| |
|
pure virtual |
When overridden in a derived class, encodes a set of characters from the specified character array and any characters in the internal buffer into the specified byte array. A parameter indicates whether to clear the internal state of the encoder after the conversion.
- Parameters
-
chars | The character array containing the set of characters to encode. |
charIndex | The index of the first character to encode. |
charCount | The number of characters to encode. |
bytes | The byte array to contain the resulting sequence of bytes. |
byteIndex | The index at which to start writing the resulting sequence of bytes. |
flush | true to clear the internal state of the encoder after the conversion; otherwise, false . |
- Returns
- The actual number of bytes written into bytes .
- Exceptions
-
T:System.ArgumentNullException | chars is null (Nothing ).-or- bytes is null (Nothing ). |
T:System.ArgumentOutOfRangeException | charIndex or charCount or byteIndex is less than zero.-or- charIndex and charCount do not denote a valid range in chars .-or- byteIndex is not a valid index in bytes . |
T:System.ArgumentException | bytes does not have enough capacity from byteIndex to the end of the array to accommodate the resulting bytes. |
T:System.Text.EncoderFallbackException | A fallback occurred (see Character Encoding in the .NET Framework for fuller explanation)-and- P:System.Text.Encoder.Fallback is set to T:System.Text.EncoderExceptionFallback. |
◆ GetBytes() [2/2]
virtual unsafe int System.Text.Encoder.GetBytes |
( |
char * |
chars, |
|
|
int |
charCount, |
|
|
byte * |
bytes, |
|
|
int |
byteCount, |
|
|
bool |
flush |
|
) |
| |
|
virtual |
When overridden in a derived class, encodes a set of characters starting at the specified character pointer and any characters in the internal buffer into a sequence of bytes that are stored starting at the specified byte pointer. A parameter indicates whether to clear the internal state of the encoder after the conversion.
- Parameters
-
chars | A pointer to the first character to encode. |
charCount | The number of characters to encode. |
bytes | A pointer to the location at which to start writing the resulting sequence of bytes. |
byteCount | The maximum number of bytes to write. |
flush | true to clear the internal state of the encoder after the conversion; otherwise, false . |
- Returns
- The actual number of bytes written at the location indicated by the bytes parameter.
- Exceptions
-
T:System.ArgumentNullException | chars is null (Nothing ).-or- bytes is null (Nothing ). |
T:System.ArgumentOutOfRangeException | charCount or byteCount is less than zero. |
T:System.ArgumentException | byteCount is less than the resulting number of bytes. |
T:System.Text.EncoderFallbackException | A fallback occurred (see Character Encoding in the .NET Framework for fuller explanation)-and- P:System.Text.Encoder.Fallback is set to T:System.Text.EncoderExceptionFallback. |
Definition at line 193 of file Encoder.cs.
◆ Reset()
virtual void System.Text.Encoder.Reset |
( |
| ) |
|
|
virtual |
When overridden in a derived class, sets the encoder back to its initial state.
Definition at line 89 of file Encoder.cs.
◆ Fallback
Gets or sets a T:System.Text.EncoderFallback object for the current T:System.Text.Encoder object.
- Returns
- A T:System.Text.EncoderFallback object.
- Exceptions
-
T:System.ArgumentNullException | The value in a set operation is null (Nothing ). |
T:System.ArgumentException | A new value cannot be assigned in a set operation because the current T:System.Text.EncoderFallbackBuffer object contains data that has not been encoded yet. |
T:System.Text.EncoderFallbackException | A fallback occurred (see Character Encoding in the .NET Framework for fuller explanation)-and- P:System.Text.Encoder.Fallback is set to T:System.Text.EncoderExceptionFallback. |
Definition at line 27 of file Encoder.cs.
◆ FallbackBuffer
Gets the T:System.Text.EncoderFallbackBuffer object associated with the current T:System.Text.Encoder object.
- Returns
- A T:System.Text.EncoderFallbackBuffer object.
Definition at line 54 of file Encoder.cs.
The documentation for this class was generated from the following file: