Early Preview
This is currently very much a preview. Please feel free to try things out,
but don't be upset if anything is not yet working. Feedback is welcome over on our
GitHub Dicussions page.
class System.​Text.​Encoder
Assembly: System.Runtime
Inheritance: object → Encoder
Converts a set of characters into a sequence of bytes.
Properties
public
EncoderFallback
Fallback
Gets or sets a <see cref="T:System.Text.EncoderFallback" /> object for the current <see cref="T:System.Text.Encoder" /> object.
public
EncoderFallbackBuffer
FallbackBuffer
Gets the <see cref="T:System.Text.EncoderFallbackBuffer" /> object associated with the current <see cref="T:System.Text.Encoder" /> object.
Methods
public
void
Convert​(Char* chars,
int charCount,
Byte* bytes,
int byteCount,
bool flush,
Int32& charsUsed,
Int32& bytesUsed,
Boolean& completed)
public
void
Convert​(char[] chars,
int charIndex,
int charCount,
byte[] bytes,
int byteIndex,
int byteCount,
bool flush,
Int32& charsUsed,
Int32& bytesUsed,
Boolean& completed)
public
void
Convert​(ReadOnlySpan`1 chars,
Span`1 bytes,
bool flush,
Int32& charsUsed,
Int32& bytesUsed,
Boolean& completed)
public
int
GetByteCount​(Char* chars,
int count,
bool flush)
chars
A pointer to the first character to encode.
count
The number of characters to encode.
flush
<see langword="true" /> to simulate clearing the internal state of the encoder after the calculation; otherwise, <see langword="false" /> .
Returns The number of bytes produced by encoding the specified characters and any characters in the internal buffer.
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.
public
int
GetByteCount​(char[] chars,
int index,
int count,
bool flush)
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
<see langword="true" /> to simulate clearing the internal state of the encoder after the calculation; otherwise, <see langword="false" /> .
Returns The number of bytes produced by encoding the specified characters and any characters in the internal buffer.
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.
public
int
GetBytes​(Char* chars,
int charCount,
Byte* bytes,
int byteCount,
bool flush)
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
<see langword="true" /> to clear the internal state of the encoder after the conversion; otherwise, <see langword="false" /> .
Returns The actual number of bytes written at the location indicated by the <paramref name="bytes" /> parameter.
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.
public
int
GetBytes​(char[] chars,
int charIndex,
int charCount,
byte[] bytes,
int byteIndex,
bool flush)
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
<see langword="true" /> to clear the internal state of the encoder after the conversion; otherwise, <see langword="false" /> .
Returns The actual number of bytes written into <paramref name="bytes" /> .
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.
public
void
Reset​()
When overridden in a derived class, sets the encoder back to its initial state.
public
bool
Equals​(object obj)
Inherited from object
obj
The object to compare with the current object.
Returns <see langword="true" /> if the specified object is equal to the current object; otherwise, <see langword="false" /> .
Determines whether the specified object is equal to the current object.
protected
void
Finalize​()
Inherited from object
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
public
int
GetHashCode​()
Inherited from object
Returns A hash code for the current object.
Serves as the default hash function.
public
Type
GetType​()
Inherited from object
Returns The exact runtime type of the current instance.
Gets the <see cref="T:System.Type" /> of the current instance.
protected
object
MemberwiseClone​()
Inherited from object
Returns A shallow copy of the current <see cref="T:System.Object" /> .
Creates a shallow copy of the current <see cref="T:System.Object" /> .
public
string
ToString​()
Inherited from object
Returns A string that represents the current object.
Returns a string that represents the current object.