Methods Summary |
---|
public int | available()Amount of bytes still available in a buffer.
return 0;
|
public int | doRead(org.apache.tomcat.util.buf.ByteChunk chunk, org.apache.coyote.Request req)Read bytes.
int result = -1;
if (contentLength >= 0) {
if (remaining > 0) {
int nRead = buffer.doRead(chunk, req);
if (nRead > remaining) {
// The chunk is longer than the number of bytes remaining
// in the body; changing the chunk length to the number
// of bytes remaining
chunk.setBytes(chunk.getBytes(), chunk.getStart(),
(int) remaining);
result = (int) remaining;
} else {
result = nRead;
}
remaining = remaining - nRead;
} else {
// No more bytes left to be read : return -1 and clear the
// buffer
chunk.recycle();
result = -1;
}
}
return result;
|
public long | end()End the current request.
// Consume extra bytes.
while (remaining > 0) {
int nread = buffer.doRead(endChunk, null);
if (nread > 0 ) {
remaining = remaining - nread;
} else { // errors are handled higher up.
remaining = 0;
}
}
// If too many bytes were read, return the amount.
return -remaining;
|
public long | getContentLength()Get content length.
// ------------------------------------------------------------- Properties
return contentLength;
|
public org.apache.tomcat.util.buf.ByteChunk | getEncodingName()Return the name of the associated encoding; Here, the value is
"identity".
return ENCODING;
|
public long | getRemaining()Get remaining bytes.
return remaining;
|
public void | recycle()Make the filter ready to process the next request.
contentLength = -1;
remaining = 0;
endChunk.recycle();
|
public void | setBuffer(org.apache.coyote.InputBuffer buffer)Set the next buffer in the filter pipeline.
this.buffer = buffer;
|
public void | setRequest(org.apache.coyote.Request request)Read the content length from the request.
contentLength = request.getContentLengthLong();
remaining = contentLength;
|