Author: violetagg Date: Thu Oct 6 11:49:10 2016 New Revision: 1763565 URL: http://svn.apache.org/viewvc?rev=1763565&view=rev Log: Use ByteBuffer instead of ByteChunk. This is in a preparation for removing o.a.coyote.InputBuffer.doRead(ByteChunk).
Modified: tomcat/trunk/java/org/apache/coyote/http11/filters/IdentityInputFilter.java Modified: tomcat/trunk/java/org/apache/coyote/http11/filters/IdentityInputFilter.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/filters/IdentityInputFilter.java?rev=1763565&r1=1763564&r2=1763565&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/http11/filters/IdentityInputFilter.java (original) +++ tomcat/trunk/java/org/apache/coyote/http11/filters/IdentityInputFilter.java Thu Oct 6 11:49:10 2016 @@ -18,6 +18,7 @@ package org.apache.coyote.http11.filters; import java.io.IOException; +import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import org.apache.coyote.InputBuffer; @@ -32,7 +33,7 @@ import org.apache.tomcat.util.res.String * * @author Remy Maucherat */ -public class IdentityInputFilter implements InputFilter { +public class IdentityInputFilter implements InputFilter, ApplicationBufferHandler { private static final StringManager sm = StringManager.getManager( IdentityInputFilter.class.getPackage().getName()); @@ -76,9 +77,9 @@ public class IdentityInputFilter impleme /** - * Chunk used to read leftover bytes. + * ByteBuffer used to read leftover bytes. */ - protected final ByteChunk endChunk = new ByteChunk(); + protected ByteBuffer tempRead; private final int maxSwallowSize; @@ -181,7 +182,8 @@ public class IdentityInputFilter impleme // Consume extra bytes. while (remaining > 0) { - int nread = buffer.doRead(endChunk); + int nread = buffer.doRead(this); + tempRead = null; if (nread > 0 ) { swallowed += nread; remaining = remaining - nread; @@ -227,7 +229,6 @@ public class IdentityInputFilter impleme public void recycle() { contentLength = -1; remaining = 0; - endChunk.recycle(); } @@ -247,4 +248,22 @@ public class IdentityInputFilter impleme // remaining return contentLength > -1 && remaining <= 0; } + + + @Override + public void setByteBuffer(ByteBuffer buffer) { + tempRead = buffer; + } + + + @Override + public ByteBuffer getByteBuffer() { + return tempRead; + } + + + @Override + public void expand(int size) { + // no-op + } } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org