You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2008/12/19 19:44:41 UTC

svn commit: r728101 - /httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/

Author: olegk
Date: Fri Dec 19 10:44:41 2008
New Revision: 728101

URL: http://svn.apache.org/viewvc?rev=728101&view=rev
Log:
Javadoc updates

Modified:
    httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/ChunkedInputStream.java
    httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/ChunkedOutputStream.java
    httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/ContentLengthInputStream.java
    httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/ContentLengthOutputStream.java
    httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/HttpRequestParser.java
    httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/HttpResponseParser.java
    httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/IdentityInputStream.java
    httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/IdentityOutputStream.java
    httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/SocketInputBuffer.java
    httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/SocketOutputBuffer.java

Modified: httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/ChunkedInputStream.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/ChunkedInputStream.java?rev=728101&r1=728100&r2=728101&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/ChunkedInputStream.java (original)
+++ httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/ChunkedInputStream.java Fri Dec 19 10:44:41 2008
@@ -44,8 +44,6 @@
 
 /**
  * Implements chunked transfer coding.
- * See <a href="http://www.w3.org/Protocols/rfc2616/rfc2616.txt">RFC 2616</a>,
- * <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.6">section 3.6.1</a>.
  * It transparently coalesces chunks of a HTTP stream that uses chunked
  * transfer coding. After the stream is read to the end, it provides access
  * to the trailers, if any.
@@ -55,7 +53,6 @@
  * close, which allows for the seamless execution of subsequent HTTP 1.1
  * requests, while not requiring the client to remember to read the entire
  * contents of the response.
- * </p>
  *
  * @author Ortwin Glueck
  * @author Sean C. Sullivan
@@ -92,6 +89,11 @@
     
     private Header[] footers = new Header[] {};
 
+    /**
+     * Wraps session input stream and reads chunk coded input.
+     *
+     * @param in The session input buffer
+     */
     public ChunkedInputStream(final SessionInputBuffer in) {
         super();
         if (in == null) {
@@ -112,7 +114,7 @@
      *
      * @return -1 of the end of the stream has been reached or the next data
      * byte
-     * @throws IOException If an IO problem occurs
+     * @throws IOException in case of an I/O error
      */
     public int read() throws IOException {
         if (this.closed) {
@@ -142,8 +144,7 @@
      * @param len the maximum number of bytes that can be returned.
      * @return The number of bytes returned or -1 if the end of stream has been
      * reached.
-     * @see java.io.InputStream#read(byte[], int, int)
-     * @throws IOException if an IO problem occurs.
+     * @throws IOException in case of an I/O error
      */
     public int read (byte[] b, int off, int len) throws IOException {
 
@@ -175,8 +176,7 @@
      * @param b The byte array that will hold the contents from the stream.
      * @return The number of bytes returned or -1 if the end of stream has been
      * reached.
-     * @see java.io.InputStream#read(byte[])
-     * @throws IOException if an IO problem occurs.
+     * @throws IOException in case of an I/O error
      */
     public int read (byte[] b) throws IOException {
         return read(b, 0, b.length);
@@ -184,7 +184,7 @@
 
     /**
      * Read the next chunk.
-     * @throws IOException If an IO error occurs.
+     * @throws IOException in case of an I/O error
      */
     private void nextChunk() throws IOException {
         chunkSize = getChunkSize();
@@ -241,7 +241,7 @@
 
     /**
      * Reads and stores the Trailer headers.
-     * @throws IOException If an IO problem occurs
+     * @throws IOException in case of an I/O error
      */
     private void parseTrailerHeaders() throws IOException {
         try {
@@ -259,7 +259,7 @@
      * Upon close, this reads the remainder of the chunked message,
      * leaving the underlying socket at a position to start reading the
      * next response without scanning.
-     * @throws IOException If an IO problem occurs.
+     * @throws IOException in case of an I/O error
      */
     public void close() throws IOException {
         if (!closed) {
@@ -278,17 +278,6 @@
         return (Header[])this.footers.clone();
     }
     
-    /**
-     * Exhaust an input stream, reading until EOF has been encountered.
-     *
-     * <p>Note that this function is intended as a non-public utility.
-     * This is a little weird, but it seemed silly to make a utility
-     * class for this one function, so instead it is just static and
-     * shared that way.</p>
-     *
-     * @param inStream The {@link InputStream} to exhaust.
-     * @throws IOException If an IO problem occurs
-     */
     static void exhaustInputStream(final InputStream inStream) throws IOException {
         // read and discard the remainder of the message
         byte buffer[] = new byte[1024];

Modified: httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/ChunkedOutputStream.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/ChunkedOutputStream.java?rev=728101&r1=728100&r2=728101&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/ChunkedOutputStream.java (original)
+++ httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/ChunkedOutputStream.java Fri Dec 19 10:44:41 2008
@@ -38,9 +38,11 @@
 
 /**
  * Implements chunked transfer coding.
- * See <a href="http://www.w3.org/Protocols/rfc2616/rfc2616.txt">RFC 2616</a>,
- * <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.6">section 3.6.1</a>.
  * Writes are buffered to an internal buffer (2048 default size).
+ * <p>
+ * Note that this class NEVER closes the underlying stream, even when close
+ * gets called.  Instead, the stream will be marked as closed and no further 
+ * output will be permitted.
  * 
  * @author Mohammad Rezaei (Goldman, Sachs &amp; Co.)
  * @author <a href="mailto:oleg at ural.ru">Oleg Kalnichevski</a>
@@ -63,10 +65,11 @@
     
     // ----------------------------------------------------------- Constructors
     /**
-     * Wraps a session output buffer and chunks the output.
-     * @param out the session output buffer to wrap
-     * @param bufferSize minimum chunk size (excluding last chunk)
-     * @throws IOException
+     * Wraps a session output buffer and chunk-encodes the output.
+     * 
+     * @param out The session output buffer
+     * @param bufferSize The minimum chunk size (excluding last chunk)
+     * @throws IOException in case of an I/O error
      */
     public ChunkedOutputStream(final SessionOutputBuffer out, int bufferSize)
             throws IOException {
@@ -80,7 +83,7 @@
      * size of 2048 was chosen because the chunk overhead is less than 0.5%
      *
      * @param out       the output buffer to wrap
-     * @throws IOException
+     * @throws IOException in case of an I/O error
      */
     public ChunkedOutputStream(final SessionOutputBuffer out) 
             throws IOException {
@@ -90,7 +93,6 @@
     // ----------------------------------------------------------- Internal methods
     /**
      * Writes the cache out onto the underlying stream
-     * @throws IOException
      */
     protected void flushCache() throws IOException {
         if (this.cachePosition > 0) {
@@ -104,10 +106,6 @@
     /**
      * Writes the cache and bufferToAppend to the underlying stream
      * as one large chunk
-     * @param bufferToAppend
-     * @param off
-     * @param len
-     * @throws IOException
      */
     protected void flushCacheWithAppend(byte bufferToAppend[], int off, int len) throws IOException {
         this.out.writeLine(Integer.toHexString(this.cachePosition + len));
@@ -125,8 +123,9 @@
 
     // ----------------------------------------------------------- Public Methods
     /**
-     * Must be called to ensure the internal cache is flushed and the closing chunk is written.
-     * @throws IOException
+     * Must be called to ensure the internal cache is flushed and the closing 
+     * chunk is written.
+     * @throws IOException in case of an I/O error
      */
     public void finish() throws IOException {
         if (!this.wroteLastChunk) {
@@ -149,13 +148,15 @@
     /**
      * Writes the array. If the array does not fit within the buffer, it is
      * not split, but rather written out as one large chunk.
-     * @param b
-     * @throws IOException
      */
     public void write(byte b[]) throws IOException {
         write(b, 0, b.length);
     }
 
+    /**
+     * Writes the array. If the array does not fit within the buffer, it is
+     * not split, but rather written out as one large chunk.
+     */
     public void write(byte src[], int off, int len) throws IOException {
         if (this.closed) {
             throw new IOException("Attempted write to closed stream.");
@@ -170,7 +171,6 @@
 
     /**
      * Flushes the content buffer and the underlying stream.
-     * @throws IOException
      */
     public void flush() throws IOException {
         flushCache();
@@ -179,7 +179,6 @@
 
     /**
      * Finishes writing to the underlying stream, but does NOT close the underlying stream.
-     * @throws IOException
      */
     public void close() throws IOException {
         if (!this.closed) {

Modified: httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/ContentLengthInputStream.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/ContentLengthInputStream.java?rev=728101&r1=728100&r2=728101&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/ContentLengthInputStream.java (original)
+++ httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/ContentLengthInputStream.java Fri Dec 19 10:44:41 2008
@@ -37,31 +37,14 @@
 import org.apache.http.io.SessionInputBuffer;
 
 /**
- * Stream that cuts off after a specified number of bytes.
+ * Stream that cuts off after a defined number of bytes.
+ * <p>
  * Note that this class NEVER closes the underlying stream, even when close
- * gets called.  Instead, it will read until the "end" of its chunking on
+ * gets called.  Instead, it will read until the "end" of its limit on
  * close, which allows for the seamless execution of subsequent HTTP 1.1
  * requests, while not requiring the client to remember to read the entire
  * contents of the response.
  *
- * <p>Implementation note: Choices abound. One approach would pass
- * through the {@link InputStream#mark} and {@link InputStream#reset} calls to
- * the underlying stream.  That's tricky, though, because you then have to
- * start duplicating the work of keeping track of how much a reset rewinds.
- * Further, you have to watch out for the "readLimit", and since the semantics
- * for the readLimit leave room for differing implementations, you might get
- * into a lot of trouble.</p>
- *
- * <p>Alternatively, you could make this class extend
- * {@link java.io.BufferedInputStream}
- * and then use the protected members of that class to avoid duplicated effort.
- * That solution has the side effect of adding yet another possible layer of
- * buffering.</p>
- *
- * <p>Then, there is the simple choice, which this takes - simply don't
- * support {@link InputStream#mark} and {@link InputStream#reset}.  That choice
- * has the added benefit of keeping this class very simple.</p>
- *
  * @author Ortwin Glueck
  * @author Eric Johnson
  * @author <a href="mailto:mbowler@GargoyleSoftware.com">Mike Bowler</a>
@@ -89,9 +72,10 @@
     private SessionInputBuffer in = null;
 
     /**
-     * Creates a new length limited stream
+     * Wraps a session input buffer and cuts off output after a defined number 
+     * of bytes.
      *
-     * @param in The session input buffer to wrap
+     * @param in The session input buffer
      * @param contentLength The maximum number of bytes that can be read from
      * the stream. Subsequent read operations will return -1.
      */

Modified: httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/ContentLengthOutputStream.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/ContentLengthOutputStream.java?rev=728101&r1=728100&r2=728101&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/ContentLengthOutputStream.java (original)
+++ httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/ContentLengthOutputStream.java Fri Dec 19 10:44:41 2008
@@ -37,7 +37,11 @@
 import org.apache.http.io.SessionOutputBuffer;
 
 /**
- * A stream wrapper that closes itself after a defined number of bytes.
+ * An output stream that cuts off after a defined number of bytes.
+ * <p>
+ * Note that this class NEVER closes the underlying stream, even when close
+ * gets called.  Instead, the stream will be marked as closed and no further 
+ * output will be permitted.
  *
  * @author <a href="mailto:oleg at ural.ru">Oleg Kalnichevski</a>
  *
@@ -48,7 +52,7 @@
 public class ContentLengthOutputStream extends OutputStream {
     
     /**
-     * Wrapped session outbut buffer.
+     * Wrapped session output buffer.
      */
     private final SessionOutputBuffer out;
 
@@ -65,9 +69,10 @@
     private boolean closed = false;
 
     /**
-     * Creates a new length limited stream
+     * Wraps a session output buffer and cuts off output after a defined number 
+     * of bytes.
      *
-     * @param out The data transmitter to wrap
+     * @param out The session output buffer
      * @param contentLength The maximum number of bytes that can be written to
      * the stream. Subsequent write operations will be ignored.
      * 

Modified: httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/HttpRequestParser.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/HttpRequestParser.java?rev=728101&r1=728100&r2=728101&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/HttpRequestParser.java (original)
+++ httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/HttpRequestParser.java Fri Dec 19 10:44:41 2008
@@ -43,6 +43,7 @@
 import org.apache.http.io.SessionInputBuffer;
 import org.apache.http.message.LineParser;
 import org.apache.http.message.ParserCursor;
+import org.apache.http.params.CoreConnectionPNames;
 import org.apache.http.params.HttpParams;
 import org.apache.http.util.CharArrayBuffer;
 
@@ -58,6 +59,22 @@
     private final CharArrayBuffer lineBuf;
     
     /**
+     * Creates an instance of this class.
+     * <p>
+     * The following HTTP parameters affect the initialization:
+     * <p>
+     * {@link CoreConnectionPNames#MAX_HEADER_COUNT} parameter determines 
+     * the maximum HTTP header count allowed. If set to a positive value, 
+     * the number of HTTP headers received from the data stream exceeding 
+     * this limit will cause an IOException. A negative or zero value will 
+     * effectively disable the check. Per default the check is disabled. 
+     * <p>
+     * {@link CoreConnectionPNames#MAX_LINE_LENGTH} parameter determines 
+     * the maximum line length limit. If set to a positive value, any HTTP line 
+     * exceeding this limit will cause an IOException. A negative or zero value
+     * will effectively disable the check the check. Per default the check is 
+     * disabled.
+     * 
      * @param buffer the session input buffer.
      * @param parser the line parser.
      * @param requestFactory the factory to use to create 

Modified: httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/HttpResponseParser.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/HttpResponseParser.java?rev=728101&r1=728100&r2=728101&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/HttpResponseParser.java (original)
+++ httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/HttpResponseParser.java Fri Dec 19 10:44:41 2008
@@ -43,6 +43,7 @@
 import org.apache.http.io.SessionInputBuffer;
 import org.apache.http.message.LineParser;
 import org.apache.http.message.ParserCursor;
+import org.apache.http.params.CoreConnectionPNames;
 import org.apache.http.params.HttpParams;
 import org.apache.http.util.CharArrayBuffer;
 
@@ -58,6 +59,22 @@
     private final CharArrayBuffer lineBuf;
     
     /**
+     * Creates an instance of this class.
+     * <p>
+     * The following HTTP parameters affect the initialization:
+     * <p>
+     * {@link CoreConnectionPNames#MAX_HEADER_COUNT} parameter determines 
+     * the maximum HTTP header count allowed. If set to a positive value, 
+     * the number of HTTP headers received from the data stream exceeding 
+     * this limit will cause an IOException. A negative or zero value will 
+     * effectively disable the check. Per default the check is disabled. 
+     * <p>
+     * {@link CoreConnectionPNames#MAX_LINE_LENGTH} parameter determines 
+     * the maximum line length limit. If set to a positive value, any HTTP line 
+     * exceeding this limit will cause an IOException. A negative or zero value
+     * will effectively disable the check the check. Per default the check is 
+     * disabled.
+     * 
      * @param buffer the session input buffer.
      * @param parser the line parser.
      * @param responseFactory the factory to use to create 

Modified: httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/IdentityInputStream.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/IdentityInputStream.java?rev=728101&r1=728100&r2=728101&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/IdentityInputStream.java (original)
+++ httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/IdentityInputStream.java Fri Dec 19 10:44:41 2008
@@ -37,7 +37,11 @@
 import org.apache.http.io.SessionInputBuffer;
 
 /**
- * A stream for reading from a {@link SessionInputBuffer session input buffer}.
+ * An input stream that reads data without any transformation.
+ * <p>
+ * Note that this class NEVER closes the underlying stream, even when close
+ * gets called.  Instead, it will read until the end of the stream (until 
+ * <code>-1</code> is returned).
  *
  * @author <a href="mailto:oleg at ural.ru">Oleg Kalnichevski</a>
  *
@@ -51,6 +55,11 @@
     
     private boolean closed = false;
     
+    /**
+     * Wraps session input stream and reads input until the the end of stream.
+     *
+     * @param in The session input buffer
+     */
     public IdentityInputStream(final SessionInputBuffer in) {
         super();
         if (in == null) {

Modified: httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/IdentityOutputStream.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/IdentityOutputStream.java?rev=728101&r1=728100&r2=728101&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/IdentityOutputStream.java (original)
+++ httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/IdentityOutputStream.java Fri Dec 19 10:44:41 2008
@@ -37,7 +37,11 @@
 import org.apache.http.io.SessionOutputBuffer;
 
 /**
- * A stream for writing with an "identity" transport encoding.
+ * An output stream that writes data without any transformation.
+ * <p>
+ * Note that this class NEVER closes the underlying stream, even when close
+ * gets called.  Instead, the stream will be marked as closed and no further 
+ * output will be permitted.
  *
  * @author <a href="mailto:oleg at ural.ru">Oleg Kalnichevski</a>
  *

Modified: httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/SocketInputBuffer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/SocketInputBuffer.java?rev=728101&r1=728100&r2=728101&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/SocketInputBuffer.java (original)
+++ httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/SocketInputBuffer.java Fri Dec 19 10:44:41 2008
@@ -36,11 +36,13 @@
 import java.net.Socket;
 
 import org.apache.http.io.EofSensor;
+import org.apache.http.io.SessionInputBuffer;
+import org.apache.http.params.CoreConnectionPNames;
+import org.apache.http.params.CoreProtocolPNames;
 import org.apache.http.params.HttpParams;
 
-
 /**
- * {@link Socket} bound session input buffer.
+ * {@link SessionInputBuffer} implementation bound to a {@link Socket}.
  *
  * @author <a href="mailto:oleg at ural.ru">Oleg Kalnichevski</a>
  *
@@ -78,6 +80,31 @@
     
     private boolean eof;
     
+    /**
+     * Creates an instance of this class. 
+     * <p>
+     * The following HTTP parameters affect the initialization:
+     * <p>
+     * The {@link CoreProtocolPNames#HTTP_ELEMENT_CHARSET}
+     * parameter determines the charset to be used for decoding HTTP lines. If 
+     * not specified, <code>US-ASCII</code> will be used per default.
+     * <p>
+     * The {@link CoreConnectionPNames#MAX_LINE_LENGTH} parameter determines 
+     * the maximum line length limit. If set to a positive value, any HTTP 
+     * line exceeding this limit will cause an IOException. A negative or zero 
+     * value will effectively disable the check. Per default the line length 
+     * check is disabled.
+     *    
+     * @param socket the socket to read data from. 
+     * @param buffersize the size of the internal buffer. If this number is less
+     *   than <code>0</code> it is set to the value of 
+     *   {@link Socket#getReceiveBufferSize()}. If resultant number is less 
+     *   than <code>1024</code> it is set to <code>1024</code>. 
+     * @param params HTTP parameters.
+     * 
+     * @see CoreProtocolPNames#HTTP_ELEMENT_CHARSET
+     * @see CoreConnectionPNames#MAX_LINE_LENGTH
+     */
     public SocketInputBuffer(
             final Socket socket, 
             int buffersize, 

Modified: httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/SocketOutputBuffer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/SocketOutputBuffer.java?rev=728101&r1=728100&r2=728101&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/SocketOutputBuffer.java (original)
+++ httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/SocketOutputBuffer.java Fri Dec 19 10:44:41 2008
@@ -34,11 +34,12 @@
 import java.io.IOException;
 import java.net.Socket;
 
+import org.apache.http.io.SessionOutputBuffer;
+import org.apache.http.params.CoreProtocolPNames;
 import org.apache.http.params.HttpParams;
 
-
 /**
- * {@link Socket} bound session output buffer.
+ * {@link SessionOutputBuffer} implementation bound to a {@link Socket}.
  *
  * @author <a href="mailto:oleg at ural.ru">Oleg Kalnichevski</a>
  *
@@ -48,6 +49,24 @@
  */
 public class SocketOutputBuffer extends AbstractSessionOutputBuffer {
 
+    /**
+     * Creates an instance of this class. 
+     * <p>
+     * The following HTTP parameters affect the initialization:
+     * <p>
+     * The {@link CoreProtocolPNames#HTTP_ELEMENT_CHARSET}
+     * parameter determines the charset to be used for encoding HTTP lines. If 
+     * not specified, <code>US-ASCII</code> will be used per default.
+     *    
+     * @param socket the socket to write data to. 
+     * @param buffersize the size of the internal buffer. If this number is less
+     *   than <code>0</code> it is set to the value of 
+     *   {@link Socket#getSendBufferSize()}. If resultant number is less 
+     *   than <code>1024</code> it is set to <code>1024</code>. 
+     * @param params HTTP parameters.
+     * 
+     * @see CoreProtocolPNames#HTTP_ELEMENT_CHARSET
+     */
     public SocketOutputBuffer(
             final Socket socket, 
             int buffersize,
@@ -57,7 +76,7 @@
             throw new IllegalArgumentException("Socket may not be null");
         }
         if (buffersize < 0) {
-            buffersize = socket.getReceiveBufferSize();
+            buffersize = socket.getSendBufferSize();
         }
         if (buffersize < 1024) {
             buffersize = 1024;