com.sun.grizzly.nio.tmpselectors
Class TemporarySelectorReader

java.lang.Object
  extended by com.sun.grizzly.AbstractReader<SocketAddress>
      extended by com.sun.grizzly.nio.tmpselectors.TemporarySelectorReader
All Implemented Interfaces:
Reader<SocketAddress>
Direct Known Subclasses:
TCPNIOTemporarySelectorReader, UDPNIOTemporarySelectorReader

public abstract class TemporarySelectorReader
extends AbstractReader<SocketAddress>

Author:
oleksiys

Field Summary
static int DEFAULT_BUFFER_SIZE
           
protected  int defaultBufferSize
           
protected  TemporarySelectorsEnabledTransport transport
           
 
Fields inherited from interface com.sun.grizzly.Reader
COMPLETE_EVENT, INCOMPLETE_EVENT, READ_EVENT
 
Constructor Summary
TemporarySelectorReader(TemporarySelectorsEnabledTransport transport)
           
 
Method Summary
protected  Buffer acquireBuffer(Connection connection)
           
 int getTimeout()
           
 TemporarySelectorsEnabledTransport getTransport()
           
 Future<ReadResult<Buffer,SocketAddress>> read(Connection connection, Buffer buffer, CompletionHandler<ReadResult<Buffer,SocketAddress>> completionHandler, Interceptor<ReadResult> interceptor)
          Method reads data to the buffer.
 Future<ReadResult<Buffer,SocketAddress>> read(Connection connection, Buffer buffer, CompletionHandler<ReadResult<Buffer,SocketAddress>> completionHandler, Interceptor<ReadResult> interceptor, long timeout, TimeUnit timeunit)
          Method reads data to the message.
protected  int read0(Connection connection, ReadResult currentResult, Buffer buffer, long timeout, TimeUnit timeunit)
           
protected abstract  int readNow0(Connection connection, Buffer buffer, ReadResult currentResult)
           
 void setTimeout(int timeout)
           
 
Methods inherited from class com.sun.grizzly.AbstractReader
read, read, read
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_BUFFER_SIZE

public static final int DEFAULT_BUFFER_SIZE
See Also:
Constant Field Values

defaultBufferSize

protected int defaultBufferSize

transport

protected final TemporarySelectorsEnabledTransport transport
Constructor Detail

TemporarySelectorReader

public TemporarySelectorReader(TemporarySelectorsEnabledTransport transport)
Method Detail

getTimeout

public int getTimeout()

setTimeout

public void setTimeout(int timeout)

read

public Future<ReadResult<Buffer,SocketAddress>> read(Connection connection,
                                                     Buffer buffer,
                                                     CompletionHandler<ReadResult<Buffer,SocketAddress>> 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

read

public Future<ReadResult<Buffer,SocketAddress>> read(Connection connection,
                                                     Buffer buffer,
                                                     CompletionHandler<ReadResult<Buffer,SocketAddress>> completionHandler,
                                                     Interceptor<ReadResult> interceptor,
                                                     long timeout,
                                                     TimeUnit timeunit)
                                              throws IOException
Method reads data to the message.

Parameters:
connection - the Connection to read from
message - the message, where data will be read
completionHandler - CompletionHandler, which will get notified, when read will be completed
condition - Condition, which will be checked each time new portion of a data was read to a buffer. The condition can decide, whether asynchronous read is completed or not.
timeout - operation timeout value value
timeunit - the timeout unit
Returns:
Future, using which it's possible to check the result
Throws:
IOException

read0

protected int read0(Connection connection,
                    ReadResult currentResult,
                    Buffer buffer,
                    long timeout,
                    TimeUnit timeunit)
             throws IOException
Throws:
IOException

readNow0

protected abstract int readNow0(Connection connection,
                                Buffer buffer,
                                ReadResult currentResult)
                         throws IOException
Throws:
IOException

acquireBuffer

protected Buffer acquireBuffer(Connection connection)

getTransport

public TemporarySelectorsEnabledTransport getTransport()


Copyright © 2009 SUN Microsystems. All Rights Reserved.