Package org.apache.http.impl.io
Class AbstractMessageWriter<T extends HttpMessage>
java.lang.Object
org.apache.http.impl.io.AbstractMessageWriter<T>
- All Implemented Interfaces:
HttpMessageWriter<T>
- Direct Known Subclasses:
DefaultHttpRequestWriter,DefaultHttpResponseWriter,HttpRequestWriter,HttpResponseWriter
public abstract class AbstractMessageWriter<T extends HttpMessage>
extends Object
implements HttpMessageWriter<T>
Abstract base class for HTTP message writers that serialize output to
an instance of
SessionOutputBuffer.- Since:
- 4.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final CharArrayBufferprotected final LineFormatterprotected final SessionOutputBuffer -
Constructor Summary
ConstructorsConstructorDescriptionAbstractMessageWriter(SessionOutputBuffer buffer, LineFormatter formatter) Creates an instance of AbstractMessageWriter.AbstractMessageWriter(SessionOutputBuffer buffer, LineFormatter formatter, HttpParams params) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionvoidSerializes an instance ofHttpMessageto the underlying data sink.protected abstract voidwriteHeadLine(T message) Subclasses must override this method to write out the first header line based on theHttpMessagepassed as a parameter.
-
Field Details
-
sessionBuffer
-
lineBuf
-
lineFormatter
-
-
Constructor Details
-
AbstractMessageWriter
@Deprecated public AbstractMessageWriter(SessionOutputBuffer buffer, LineFormatter formatter, HttpParams params) Deprecated.Creates an instance of AbstractMessageWriter.- Parameters:
buffer- the session output buffer.formatter- the line formatter.params- HTTP parameters.
-
AbstractMessageWriter
Creates an instance of AbstractMessageWriter.- Parameters:
buffer- the session output buffer.formatter- the line formatter IfnullBasicLineFormatter.INSTANCEwill be used.- Since:
- 4.3
-
-
Method Details
-
writeHeadLine
Subclasses must override this method to write out the first header line based on theHttpMessagepassed as a parameter.- Parameters:
message- the message whose first line is to be written out.- Throws:
IOException- in case of an I/O error.
-
write
Description copied from interface:HttpMessageWriterSerializes an instance ofHttpMessageto the underlying data sink.- Specified by:
writein interfaceHttpMessageWriter<T extends HttpMessage>- Parameters:
message- HTTP message- Throws:
IOException- in case of an I/O errorHttpException- in case of HTTP protocol violation
-
AbstractMessageWriter(SessionOutputBuffer, LineFormatter)