public void Append(Encoder encoder, String str) { var encodeLength = encoder.GetEncodeLength(str); EnsureTotalCapacity(contentLength + encodeLength); encoder.Encode(str, bytes, contentLength); contentLength += encodeLength; }
public TypedSink(Boolean flushAtWriteLine, Encoder defaultEncoder) { this.flushAtWriteLine = flushAtWriteLine; this.defaultEncoder = (defaultEncoder == null) ? Encoder.Utf8 : null; this.defaultEncoderNewline = new Byte[defaultEncoder.GetEncodeLength(Environment.NewLine)]; defaultEncoder.Encode(Environment.NewLine, this.defaultEncoderNewline, 0); }