/// <summary>Creates an instance of AbstractMessageWriter.</summary> /// <remarks>Creates an instance of AbstractMessageWriter.</remarks> /// <param name="buffer">the session output buffer.</param> /// <param name="formatter"> /// the line formatter If <code>null</code> /// <see cref="Org.Apache.Http.Message.BasicLineFormatter.Instance">Org.Apache.Http.Message.BasicLineFormatter.Instance /// </see> /// will be used. /// </param> /// <since>4.3</since> public AbstractMessageWriter(SessionOutputBuffer buffer, LineFormatter formatter) : base() { this.sessionBuffer = Args.NotNull(buffer, "Session input buffer"); this.lineFormatter = (formatter != null) ? formatter : BasicLineFormatter.Instance; this.lineBuf = new CharArrayBuffer(128); }
protected internal virtual OutputStream CreateOutputStream(long len, SessionOutputBuffer outbuffer) { if (len == ContentLengthStrategy.Chunked) { return(new ChunkedOutputStream(2048, outbuffer)); } else { if (len == ContentLengthStrategy.Identity) { return(new IdentityOutputStream(outbuffer)); } else { return(new ContentLengthOutputStream(outbuffer, len)); } } }
public virtual HttpMessageWriter <IHttpRequest> Create(SessionOutputBuffer buffer) { return(new DefaultHttpRequestWriter(buffer, lineFormatter)); }
/// <summary> /// Wraps a session output buffer and cuts off output after a defined number /// of bytes. /// </summary> /// <remarks> /// Wraps a session output buffer and cuts off output after a defined number /// of bytes. /// </remarks> /// <param name="out">The session output buffer</param> /// <param name="contentLength"> /// The maximum number of bytes that can be written to /// the stream. Subsequent write operations will be ignored. /// </param> /// <since>4.0</since> public ContentLengthOutputStream(SessionOutputBuffer @out, long contentLength) : base() { this.@out = Args.NotNull(@out, "Session output buffer"); this.contentLength = Args.NotNegative(contentLength, "Content length"); }
public DefaultHttpRequestWriter(SessionOutputBuffer buffer) : this(buffer, null) { }
/// <summary>Creates an instance of DefaultHttpRequestWriter.</summary> /// <remarks>Creates an instance of DefaultHttpRequestWriter.</remarks> /// <param name="buffer">the session output buffer.</param> /// <param name="formatter"> /// the line formatter If <code>null</code> /// <see cref="Org.Apache.Http.Message.BasicLineFormatter.Instance">Org.Apache.Http.Message.BasicLineFormatter.Instance /// </see> /// will be used. /// </param> public DefaultHttpRequestWriter(SessionOutputBuffer buffer, LineFormatter formatter ) : base(buffer, formatter) { }
public DefaultHttpResponseWriter(SessionOutputBuffer buffer) : base(buffer, null) { }
/// <summary>Wraps a session output buffer and chunk-encodes the output.</summary> /// <remarks>Wraps a session output buffer and chunk-encodes the output.</remarks> /// <param name="bufferSize">The minimum chunk size (excluding last chunk)</param> /// <param name="out">The session output buffer</param> public ChunkedOutputStream(int bufferSize, SessionOutputBuffer @out) : base() { // ----------------------------------------------------- Instance Variables this.cache = new byte[bufferSize]; this.@out = @out; }
/// <summary>Wraps a session output buffer and chunks the output.</summary> /// <remarks> /// Wraps a session output buffer and chunks the output. The default buffer /// size of 2048 was chosen because the chunk overhead is less than 0.5% /// </remarks> /// <param name="out">the output buffer to wrap</param> /// <exception cref="System.IO.IOException">not thrown</exce [System.ObsoleteAttribute(@"(4.3) use ChunkedOutputStream(int, Org.Apache.Http.IO.SessionOutputBuffer)")]fer)" public ChunkedOutputStream(SessionOutputBuffer @out) : this(2048, @out) { }
/// <summary>Wraps a session output buffer and chunk-encodes the output.</summary> /// <remarks>Wraps a session output buffer and chunk-encodes the output.</remarks> /// <param name="out">The session output buffer</param> /// <param name="bufferSize">The minimum chunk size (excluding last chunk)</param> /// <exception cref="System.IO.IOException">not thrown</exception> [System.ObsoleteAttribute(@"(4.3) use ChunkedOutputStream(int, Org.Apache.Http.IO.SessionOutputBuffer)")] public ChunkedOutputStream(SessionOutputBuffer @out, int bufferSize) : this(bufferSize , @out) { }
public IdentityOutputStream(SessionOutputBuffer @out) : base() { this.@out = Args.NotNull(@out, "Session output buffer"); }