/// <summary> /// Write partial response. /// </summary> /// <param name="text"> /// Text to be sent using the Encoding of <see cref="ResponseTextEncoding"/> property. /// </param> public void Write(string text) { var data = ResponseTextEncoding.GetBytes(text); this.ResponseBody.Write(data, 0, data.Length); this.ResponseBody.Flush(); }
/// <summary> /// 使用指定的 <see cref="ResponseTextEncoding"/> 来获得最终的结果字符串 /// </summary> /// <param name="removeBom">是否已经检测到BOM头。如果为 <see langword="true" />,则表明已经检测到了BOM头,最好能移除BOM头</param> /// <returns>代表结果的 <see langword="string"/></returns> protected virtual string GetDataString(bool removeBom) { return(ResponseTextEncoding.GetString(Result, removeBom ? 3 : 0, removeBom ? Result.Length - 3 : Result.Length)); }