use of org.apache.hc.core5.http.nio.SessionOutputBuffer in project httpcomponents-core by apache.
the class AbstractMessageWriter method write.
@Override
public void write(final T message, final SessionOutputBuffer sessionBuffer) throws IOException, HttpException {
Args.notNull(message, "HTTP message");
Args.notNull(sessionBuffer, "Session output buffer");
writeHeadLine(message, this.lineBuf);
sessionBuffer.writeLine(this.lineBuf);
for (final Iterator<Header> it = message.headerIterator(); it.hasNext(); ) {
final Header header = it.next();
if (header instanceof FormattedHeader) {
final CharArrayBuffer buffer = ((FormattedHeader) header).getBuffer();
sessionBuffer.writeLine(buffer);
} else {
this.lineBuf.clear();
this.lineFormatter.formatHeader(this.lineBuf, header);
sessionBuffer.writeLine(this.lineBuf);
}
}
this.lineBuf.clear();
sessionBuffer.writeLine(this.lineBuf);
}
Aggregations