*/
protected class SocketInputBuffer implements InputBuffer {
-
/**
- * Read bytes into the specified chunk.
+ * Read bytes into the specified chunk. If no chunk is specified, the
+ * bytes are swallowed.
*/
@Override
public int doRead(ByteChunk chunk, Request req)
}
ByteChunk bc = bodyBytes.getByteChunk();
bodyBytesRead += bc.getLength();
- chunk.setBytes(bc.getBuffer(), bc.getStart(), bc.getLength());
+ if (chunk != null) {
+ chunk.setBytes(bc.getBuffer(), bc.getStart(), bc.getLength());
+ }
empty = true;
return bc.getLength();
}