org.apache.http.impl.nio.codecs
Class AbstractMessageWriter

java.lang.Object
  extended by org.apache.http.impl.nio.codecs.AbstractMessageWriter
All Implemented Interfaces:
NHttpMessageWriter
Direct Known Subclasses:
HttpRequestWriter, HttpResponseWriter

public abstract class AbstractMessageWriter
extends Object
implements NHttpMessageWriter

Abstract NHttpMessageWriter that serves as a base for all message writer implementations.

Since:
4.0
Version:
$Revision: 744538 $

Field Summary
protected  CharArrayBuffer lineBuf
           
protected  LineFormatter lineFormatter
           
protected  SessionOutputBuffer sessionBuffer
           
 
Constructor Summary
AbstractMessageWriter(SessionOutputBuffer buffer, LineFormatter formatter, HttpParams params)
          Creates an instance of this class.
 
Method Summary
 void reset()
          Resets the writer.
 void write(HttpMessage message)
          Serializes out the HTTP message head.
protected abstract  void writeHeadLine(HttpMessage message)
          Writes out the first line of HttpMessage.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sessionBuffer

protected final SessionOutputBuffer sessionBuffer

lineBuf

protected final CharArrayBuffer lineBuf

lineFormatter

protected final LineFormatter lineFormatter
Constructor Detail

AbstractMessageWriter

public AbstractMessageWriter(SessionOutputBuffer buffer,
                             LineFormatter formatter,
                             HttpParams params)
Creates an instance of this class.

Parameters:
buffer - the session output buffer.
formatter - the line formatter.
params - HTTP parameters.
Method Detail

reset

public void reset()
Description copied from interface: NHttpMessageWriter
Resets the writer. The writer will be ready to start serializing another HTTP message.

Specified by:
reset in interface NHttpMessageWriter

writeHeadLine

protected abstract void writeHeadLine(HttpMessage message)
                               throws IOException
Writes out the first line of HttpMessage.

Parameters:
message - HTTP message.
Throws:
HttpException - in case of HTTP protocol violation
IOException

write

public void write(HttpMessage message)
           throws IOException,
                  HttpException
Description copied from interface: NHttpMessageWriter
Serializes out the HTTP message head.

Specified by:
write in interface NHttpMessageWriter
Parameters:
message - HTTP message.
Throws:
IOException - in case of an I/O error.
HttpException - in case the HTTP message is malformed or violates the HTTP protocol.


Copyright © 2005-2009 Apache Software Foundation. All Rights Reserved.