hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r790705 - in /httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http: impl/nio/codecs/ChunkEncoder.java nio/util/BufferInfo.java
Date Thu, 02 Jul 2009 18:41:36 GMT
Author: olegk
Date: Thu Jul  2 18:41:35 2009
New Revision: 790705

URL: http://svn.apache.org/viewvc?rev=790705&view=rev
Log:
ChunkEncoder can now work with SessionOutputBuffer instances that do not implement BufferInfo

Modified:
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/ChunkEncoder.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/util/BufferInfo.java

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/ChunkEncoder.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/ChunkEncoder.java?rev=790705&r1=790704&r2=790705&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/ChunkEncoder.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/ChunkEncoder.java
Thu Jul  2 18:41:35 2009
@@ -58,7 +58,11 @@
             final HttpTransportMetricsImpl metrics) {
         super(channel, buffer, metrics);
         this.lineBuffer = new CharArrayBuffer(16);
-        this.bufferinfo = (BufferInfo) buffer;
+        if (buffer instanceof BufferInfo) {
+            this.bufferinfo = (BufferInfo) buffer;
+        } else {
+            this.bufferinfo = null;
+        }
     }
 
     public int write(final ByteBuffer src) throws IOException {
@@ -75,7 +79,12 @@
         if (bytesWritten > 0) {
             this.metrics.incrementBytesTransferred(bytesWritten);
         }
-        int avail = this.bufferinfo.available();
+        int avail;
+        if (this.bufferinfo != null) {
+            avail = this.bufferinfo.available();
+        } else {
+            avail = 4096;
+        }
         if (avail == 0) {
             return 0;
         }

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/util/BufferInfo.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/util/BufferInfo.java?rev=790705&r1=790704&r2=790705&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/util/BufferInfo.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/util/BufferInfo.java
Thu Jul  2 18:41:35 2009
@@ -33,10 +33,6 @@
 
 /**
  * Basic buffer properties.
- * <p>
- * This interface should be eliminated in the next major release and its 
- * methods added to {@link org.apache.http.nio.reactor.SessionOutputBuffer}
- * and {@link org.apache.http.nio.reactor.SessionInputBuffer} interfaces.
  *
  * @since 4.0
  */



Mime
View raw message