| Method from org.apache.coyote.http11.filters.IdentityInputFilter Detail: |
public int available() {
return 0;
}
Amount of bytes still available in a buffer. |
public int doRead(ByteChunk chunk,
Request req) throws IOException {
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() throws IOException {
// 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() {
// ------------------------------------------------------------- Properties
return contentLength;
}
|
public ByteChunk getEncodingName() {
return ENCODING;
}
Return the name of the associated encoding; Here, the value is
"identity". |
public long getRemaining() {
return remaining;
}
|
public void recycle() {
contentLength = -1;
remaining = 0;
endChunk.recycle();
}
Make the filter ready to process the next request. |
public void setBuffer(InputBuffer buffer) {
this.buffer = buffer;
}
Set the next buffer in the filter pipeline. |
public void setRequest(Request request) {
contentLength = request.getContentLengthLong();
remaining = contentLength;
}
Read the content length from the request. |