/** * This method is used to consume bytes from the provided cursor. * Consuming of bytes from the cursor should be done in such a * way that it does not block. So typically only the number of * ready bytes in the <code>ByteCursor</code> object should be * read. If there are no ready bytes then this will return. * * @param cursor used to consume the bytes from the HTTP pipeline */ public void consume(ByteCursor cursor) throws IOException { ByteCounter counter = new ByteCounter(cursor); while(counter.isReady()) { if(consumer.isFinished()) { break; } consumer.consume(counter); } }
/** * This method is used to consume bytes from the provided cursor. * Consuming of bytes from the cursor should be done in such a * way that it does not block. So typically only the number of * ready bytes in the <code>ByteCursor</code> object should be * read. If there are no ready bytes then this will return. * * @param cursor used to consume the bytes from the HTTP pipeline */ public void consume(ByteCursor cursor) throws IOException { ByteCounter counter = new ByteCounter(cursor); while(counter.isReady()) { if(consumer.isFinished()) { break; } consumer.consume(counter); } }