protected ContentEncodingStream(Stream stream, ICryptoTransform transform, byte[] eolPrependBytes, MimeFormat format) { if (stream == null) throw new ArgumentNullException("stream"); if (!stream.CanWrite) throw new ArgumentException("stream must be writable", "stream"); if (format == null) throw new ArgumentNullException("format"); var bufferBlockSize = transform.CanTransformMultipleBlocks ? (folding == 0 ? 128 : folding) : 1; this.transform = transform; this.folding = format.Folding; this.outputBuffer = new byte[bufferBlockSize * transform.OutputBlockSize]; this.inputBuffer = new byte[bufferBlockSize * transform.InputBlockSize]; this.inputCount = 0; this.stream = stream; this.eol = format.GetEOLBytes(); this.eolPrependBytes = eolPrependBytes; }