com.sun.grizzly
Interface Reader<L>

All Known Subinterfaces:
AsyncQueueReader<L>
All Known Implementing Classes:
AbstractNIOAsyncQueueReader, AbstractReader, TCPNIOAsyncQueueReader, TCPNIOTemporarySelectorReader, TemporarySelectorReader, UDPNIOAsyncQueueReader, UDPNIOTemporarySelectorReader

public interface Reader<L>

Implementatios of this interface are able to read data from Connection to a Buffer. There are two basic Reader implementations in Grizzly: AsyncQueueReader, TemporarySelectorReader.

Author:
Alexey Stashok

Field Summary
static int COMPLETE_EVENT
           
static int INCOMPLETE_EVENT
           
static int READ_EVENT
           
 
Method Summary
 Future<ReadResult<Buffer,L>> read(Connection connection)
          Method reads data.
 Future<ReadResult<Buffer,L>> read(Connection connection, Buffer buffer)
          Method reads data to the buffer.
 Future<ReadResult<Buffer,L>> read(Connection connection, Buffer buffer, CompletionHandler<ReadResult<Buffer,L>> completionHandler)
          Method reads data to the buffer.
 Future<ReadResult<Buffer,L>> read(Connection connection, Buffer buffer, CompletionHandler<ReadResult<Buffer,L>> completionHandler, Interceptor<ReadResult> interceptor)
          Method reads data to the buffer.
 

Field Detail

READ_EVENT

static final int READ_EVENT
See Also:
Constant Field Values

COMPLETE_EVENT

static final int COMPLETE_EVENT
See Also:
Constant Field Values

INCOMPLETE_EVENT

static final int INCOMPLETE_EVENT
See Also:
Constant Field Values
Method Detail

read

Future<ReadResult<Buffer,L>> read(Connection connection)
                                  throws IOException
Method reads data.

Parameters:
connection - the Connection to read from
Returns:
Future, using which it's possible to check the result
Throws:
IOException

read

Future<ReadResult<Buffer,L>> read(Connection connection,
                                  Buffer buffer)
                                  throws IOException
Method reads data to the buffer.

Parameters:
connection - the Connection to read from
buffer - the buffer, where data will be read
Returns:
Future, using which it's possible to check the result
Throws:
IOException

read

Future<ReadResult<Buffer,L>> read(Connection connection,
                                  Buffer buffer,
                                  CompletionHandler<ReadResult<Buffer,L>> completionHandler)
                                  throws IOException
Method reads data to the buffer.

Parameters:
connection - the Connection to read from
buffer - the buffer, where data will be read
completionHandler - CompletionHandler, which will get notified, when read will be completed
Returns:
Future, using which it's possible to check the result
Throws:
IOException

read

Future<ReadResult<Buffer,L>> read(Connection connection,
                                  Buffer buffer,
                                  CompletionHandler<ReadResult<Buffer,L>> completionHandler,
                                  Interceptor<ReadResult> interceptor)
                                  throws IOException
Method reads data to the buffer.

Parameters:
connection - the Connection to read from
buffer - the buffer, where data will be read
completionHandler - CompletionHandler, which will get notified, when read will be completed
interceptor - Interceptor, which will be able to intercept control each time new portion of a data was read to a buffer. The interceptor can decide, whether asynchronous read is completed or not, or provide other processing instructions.
Returns:
Future, using which it's possible to check the result
Throws:
IOException


Copyright © 2009 SUN Microsystems. All Rights Reserved.