Encoding.GetDecoder 方法

定义

在派生类中重写时,获取将编码字节序列转换为字符序列的解码器。

public:
 virtual System::Text::Decoder ^ GetDecoder();
public virtual System.Text.Decoder GetDecoder();
abstract member GetDecoder : unit -> System.Text.Decoder
override this.GetDecoder : unit -> System.Text.Decoder
Public Overridable Function GetDecoder () As Decoder

返回

Decoder将编码的字节序列转换为字符序列。

注解

该方法 Decoder.GetChars 以类似于 GetChars 此类的方法将连续字节块转换为顺序字符块。 但是,在 Decoder 调用之间维护状态信息,以便正确解码跨块的字节序列。 它还 Decoder 保留数据块末尾的尾随字节,并在下一个解码操作中使用尾随字节。 因此, GetDecoder 对于 GetEncoder 网络传输和文件操作非常有用,因为这些操作通常处理数据块而不是完整的数据流。

继承者说明

默认实现返回一个Decoder调用当前EncodingGetChars(Byte[])方法的实现GetCharCount(Byte[])。 必须重写此方法才能返回在调用之间保持其状态的一个 Decoder

适用于

另请参阅