Top Description Fields Constructors Methods
org.apache.hc.core5.http.impl.io

public abstract Class AbstractMessageWriter<T extends org.apache.hc.core5.http.HttpMessage>

extends Object
implements HttpMessageWriter<T extends HttpMessage>
Class Inheritance
All Implemented Interfaces
org.apache.hc.core5.http.io.HttpMessageWriter
Known Direct Subclasses
org.apache.hc.core5.http.impl.io.DefaultHttpRequestWriter, org.apache.hc.core5.http.impl.io.DefaultHttpResponseWriter
Imports
java.io.IOException, .OutputStream, java.util.Iterator, org.apache.hc.core5.http.FormattedHeader, .Header, .HttpException, .HttpMessage, org.apache.hc.core5.http.io.HttpMessageWriter, .SessionOutputBuffer, org.apache.hc.core5.http.message.BasicLineFormatter, .LineFormatter, org.apache.hc.core5.util.Args, .CharArrayBuffer

Abstract base class for HTTP message writers that serialize output to an instance of org.apache.hc.core5.http.io.SessionOutputBuffer.
Since
4.0

Field Summary

Modifier and TypeField and Description
private final CharArrayBuffer
private final LineFormatter

Constructor Summary

AccessConstructor and Description
public
AbstractMessageWriter(final LineFormatter
the line formatter If null BasicLineFormatter#INSTANCE will be used.
formatter
)

Creates an instance of AbstractMessageWriter.

Method Summary

Modifier and TypeMethod and Description
pack-priv LineFormatter
public void
write(final T
HTTP message head
message
,
final SessionOutputBuffer
session output buffer
buffer
,
final OutputStream outputStream)

Implements org.apache.hc.core5.http.io.HttpMessageWriter.write.

Serializes an instance of MessageHeaders to the given output stream.
protected abstract void
writeHeadLine(T
the message whose first line is to be written out.
message
,
CharArrayBuffer
line buffer
lineBuf
)

Subclasses must override this method to write out the first header line based on the HttpMessage passed as a parameter.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

lineBufback to summary
private final CharArrayBuffer lineBuf
lineFormatterback to summary
private final LineFormatter lineFormatter

Constructor Detail

AbstractMessageWriterback to summary
public AbstractMessageWriter(final LineFormatter formatter)

Creates an instance of AbstractMessageWriter.

Parameters
formatter:LineFormatter

the line formatter If null BasicLineFormatter#INSTANCE will be used.

Since
4.3

Method Detail

getLineFormatterback to summary
pack-priv LineFormatter getLineFormatter()
writeback to summary
public void write(final T message, final SessionOutputBuffer buffer, final OutputStream outputStream) throws IOException, HttpException

Implements org.apache.hc.core5.http.io.HttpMessageWriter.write.

Doc from org.apache.hc.core5.http.io.HttpMessageWriter.write.

Serializes an instance of MessageHeaders to the given output stream.

Parameters
message:T

HTTP message head

buffer:SessionOutputBuffer

session output buffer

Annotations
@Override
Exceptions
IOException:
in case of an I/O error
HttpException:
in case of HTTP protocol violation
writeHeadLineback to summary
protected abstract void writeHeadLine(T message, CharArrayBuffer lineBuf) throws IOException

Subclasses must override this method to write out the first header line based on the HttpMessage passed as a parameter.

Parameters
message:T

the message whose first line is to be written out.

lineBuf:CharArrayBuffer

line buffer

Exceptions
IOException:
in case of an I/O error.