Class Encoding
Represents a character encoding.
public abstract class Encoding
- Inheritance
-
Encoding
- Derived
- Inherited Members
- Extension Methods
Constructors
Encoding()
protected Encoding()
Properties
UTF8
Gets an encoding for the UTF-8 format.
public static Encoding UTF8 { get; }
Property Value
- Encoding
An encoding for the UTF-8 format.
Methods
GetBytes(string)
When overridden in a derived class, encodes all the characters in the specified string into a sequence of bytes.
public virtual byte[] GetBytes(string s)
Parameters
s
stringThe string containing the characters to encode.
Returns
- byte[]
A byte array containing the results of encoding the specified set of characters.
GetBytes(string, int, int, byte[], int)
When overridden in a derived class, encodes a set of characters from the specified string into the specified byte array.
public virtual int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex)
Parameters
s
stringThe string containing the set of characters to encode.
charIndex
intThe index of the first character to encode.
charCount
intThe number of characters to encode.
bytes
byte[]The byte array to contain the resulting sequence of bytes.
byteIndex
intThe index at which to start writing the resulting sequence of bytes.
Returns
- int
The actual number of bytes written into bytes.
Exceptions
GetChars(byte[])
When overridden in a derived class, decodes all the bytes in the specified byte array into a set of characters.
public virtual char[] GetChars(byte[] bytes)
Parameters
bytes
byte[]The byte array containing the sequence of bytes to decode.
Returns
- char[]
A character array containing the results of decoding the specified sequence of bytes.
Exceptions
GetChars(byte[], int, int)
When overridden in a derived class, decodes a sequence of bytes from the specified byte array into a set of characters.
public virtual char[] GetChars(byte[] bytes, int byteIndex, int byteCount)
Parameters
bytes
byte[]The byte array containing the sequence of bytes to decode.
byteIndex
intThe index of the first byte to decode.
byteCount
intThe number of bytes to decode.
Returns
- char[]
A character array containing the results of decoding the specified sequence of bytes.
Exceptions
GetDecoder()
When overridden in a derived class, obtains a decoder that converts an encoded sequence of bytes into a sequence of characters.
public abstract Decoder GetDecoder()
Returns
- Decoder
A Decoder that converts an encoded sequence of bytes into a sequence of characters.
GetString(byte[], int, int)
When overridden in a derived class, decodes a sequence of bytes from the specified byte array into a string.
public virtual string GetString(byte[] bytes, int index, int count)
Parameters
bytes
byte[]The byte array containing the sequence of bytes to decode.
index
intThe index of the first byte to decode.
count
intThe number of bytes to decode.