org.restlet.engine.io
Interface BufferProcessor

All Known Implementing Classes:
BufferedSelectionChannel, ClientInboundWay, ClientOutboundWay, HttpClientInboundWay, HttpClientOutboundWay, HttpServerInboundWay, HttpServerOutboundWay, InboundWay, NbChannelInputStream, OutboundWay, ReadableBufferedChannel, ReadableChunkedChannel, ReadableSizedSelectionChannel, ServerInboundWay, ServerOutboundWay, Way, WritableBufferedChannel

public interface BufferProcessor

Interface called back when IO buffer draining or filling can actually be done.

Author:
Jerome Louvel

Method Summary
 boolean canLoop(Buffer buffer, Object... args)
          Indicates if the processing loop can continue.
 boolean couldFill(Buffer buffer, Object... args)
          Indicates if the buffer could be filled again.
 int onDrain(Buffer buffer, int maxDrained, Object... args)
          Drains the byte buffer.
 int onFill(Buffer buffer, Object... args)
          Fills the byte buffer.
 void onFillEof()
          Called back when a fill operation returns with an EOF status.
 void postProcess(int drained)
          Called back after a complete processing pass.
 int preProcess(int maxDrained, Object... args)
          Called back before a processing pass.
 

Method Detail

canLoop

boolean canLoop(Buffer buffer,
                Object... args)
Indicates if the processing loop can continue.

Parameters:
buffer - The IO buffer to drain.
args - The optional arguments to pass back to the callbacks.
Returns:
True if the processing loop can continue.

couldFill

boolean couldFill(Buffer buffer,
                  Object... args)
Indicates if the buffer could be filled again.

Parameters:
buffer - The IO buffer to fill.
args - The optional arguments to pass back to the callbacks.
Returns:
True if the buffer could be filled again.

onDrain

int onDrain(Buffer buffer,
            int maxDrained,
            Object... args)
            throws IOException
Drains the byte buffer.

Parameters:
buffer - The IO buffer to drain.
maxDrained - The maximum number of bytes drained by this call.
args - The optional arguments to pass back to the callbacks.
Returns:
The number of bytes drained.
Throws:
IOException

onFill

int onFill(Buffer buffer,
           Object... args)
           throws IOException
Fills the byte buffer.

Parameters:
buffer - The IO buffer to drain.
args - The optional arguments to pass back to the callbacks.
Returns:
The number of bytes filled.
Throws:
IOException

onFillEof

void onFillEof()
Called back when a fill operation returns with an EOF status.


postProcess

void postProcess(int drained)
                 throws IOException
Called back after a complete processing pass.

Parameters:
drained - The number of bytes drained or -1 if the filling source has ended.
Throws:
IOException

preProcess

int preProcess(int maxDrained,
               Object... args)
               throws IOException
Called back before a processing pass.

Parameters:
maxDrained - The maximum number of bytes drained by this call or 0 for unlimited length.
args - The optional arguments to pass back to the callbacks.
Returns:
The number of bytes drained or -1 if the filling source has ended.
Throws:
IOException


Copyright © 2005-2013 Restlet.