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

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

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

Abstract NHttpMessageWriter that serves as a base for all message writer implementations.
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
public void
write(final T
HTTP message.
message
,
final SessionOutputBuffer
session output buffer.
sessionBuffer
)

Implements org.apache.hc.core5.http.nio.NHttpMessageWriter.write.

Writes out the HTTP message head.
protected abstract void
writeHeadLine(T
HTTP message.
message
,
CharArrayBuffer buffer)

Writes out the first line of HttpMessage.

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()
resetback to summary
public void reset()

Implements org.apache.hc.core5.http.nio.NHttpMessageWriter.reset.

Doc from org.apache.hc.core5.http.nio.NHttpMessageWriter.reset.

Resets the writer. The writer will be ready to start serializing another HTTP message.

Annotations
@Override
writeback to summary
public void write(final T message, final SessionOutputBuffer sessionBuffer) throws IOException, HttpException

Implements org.apache.hc.core5.http.nio.NHttpMessageWriter.write.

Doc from org.apache.hc.core5.http.nio.NHttpMessageWriter.write.

Writes out the HTTP message head.

Parameters
message:T

HTTP message.

sessionBuffer:SessionOutputBuffer

session output buffer.

Annotations
@Override
Exceptions
IOException:
in case of an I/O error.
HttpException:
in case the HTTP message is malformed or violates the HTTP protocol.
writeHeadLineback to summary
protected abstract void writeHeadLine(T message, CharArrayBuffer buffer) throws IOException

Writes out the first line of HttpMessage.

Parameters
message:T

HTTP message.