## com.sun.grizzly.async
Class AbstractAsyncQueueReader

    java.lang.Object
      com.sun.grizzly.async.AbstractAsyncQueueReader

All Implemented Interfaces:
  AsyncQueueReader

Direct Known Subclasses:
  TCPAsyncQueueReader, UDPAsyncQueueReader

    public abstract class AbstractAsyncQueueReader

extends Object
implements AsyncQueueReader

Author:
  oleksiys

Constructor Summary
`AbstractAsyncQueueReader(SelectorHandler selectorHandler)`

Method Summary
`void` `close()` Close `AsyncQueueReader` and release its resources
`protected abstract SocketAddress` `doRead(ReadableByteChannel channel, ByteBuffer byteBuffer, AsyncQueueDataProcessor readPostProcessor)`
`boolean` `isAsyncQueueReaderEnabledFor(SelectionKey key)` Checks whether `AsyncQueueReader` is registered for the `SelectableChannel`, associated with the given `SelectionKey`
`void` `onClose(SelectableChannel channel)` Callback method, which should be called by `SelectorHandler` to notify, that given `SelectableChannel` is going to be closed, so related data could be released from `AsyncQueueReader`
`void` `onRead(SelectionKey key)` Callback method, which should be called by `SelectorHandler` to notify, that `SelectableChannel`, associated with the given `SelectableChannel` has ready data for reading.
`void` `read(SelectionKey key, ByteBuffer buffer, AsyncReadCallbackHandler callbackHandler)`
`void` `read(SelectionKey key, ByteBuffer buffer, AsyncReadCallbackHandler callbackHandler, AsyncReadCondition condition)`
`void` `read(SelectionKey key, ByteBuffer buffer, AsyncReadCallbackHandler callbackHandler, AsyncReadCondition condition, AsyncQueueDataProcessor readPostProcessor)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### AbstractAsyncQueueReader

    public AbstractAsyncQueueReader(SelectorHandler selectorHandler)

Method Detail

### read

    public void read(SelectionKey key,
                     ByteBuffer buffer,
                     AsyncReadCallbackHandler callbackHandler)
              throws IOException

  Specified by:
    `read` in interface `AsyncQueueReader`
  Throws:
    `IOException`

### read

    public void read(SelectionKey key,
                     ByteBuffer buffer,
                     AsyncReadCallbackHandler callbackHandler,
                     AsyncReadCondition condition)
              throws IOException

  Specified by:
    `read` in interface `AsyncQueueReader`
  Throws:
    `IOException`

### read

    public void read(SelectionKey key,
                     ByteBuffer buffer,
                     AsyncReadCallbackHandler callbackHandler,
                     AsyncReadCondition condition,
                     AsyncQueueDataProcessor readPostProcessor)
              throws IOException

  Specified by:
    `read` in interface `AsyncQueueReader`
  Throws:
    `IOException`

### isAsyncQueueReaderEnabledFor

    public boolean isAsyncQueueReaderEnabledFor(SelectionKey key)

  Checks whether `AsyncQueueReader` is registered for the `SelectableChannel`, associated with the given `SelectionKey`

  Specified by:
    `isAsyncQueueReaderEnabledFor` in interface `AsyncQueueReader`
  Parameters:
    `key` - `SelectionKey` associated with `SelectableChannel`
  Returns:
    true, if there is ready data. False otherwise.

### onRead

    public void onRead(SelectionKey key)
                throws IOException

  Callback method, which should be called by `SelectorHandler` to notify, that `SelectableChannel`, associated with the given `SelectableChannel` has ready data for reading.

  Specified by:
    `onRead` in interface `AsyncQueueReader`
  Parameters:
    `key` - `SelectionKey` associated with `SelectableChannel`
  Throws:
    `IOException`

### onClose

    public void onClose(SelectableChannel channel)

  Callback method, which should be called by `SelectorHandler` to notify, that given `SelectableChannel` is going to be closed, so related data could be released from `AsyncQueueReader`

  Specified by:
    `onClose` in interface `AsyncQueueReader`

### close

    public void close()

  Close `AsyncQueueReader` and release its resources

  Specified by:
    `close` in interface `AsyncQueueReader`

### doRead

    protected abstract SocketAddress doRead(ReadableByteChannel channel,
                                            ByteBuffer byteBuffer,
                                            AsyncQueueDataProcessor readPostProcessor)
                                     throws IOException

  Throws:
    `IOException`

Copyright © 2008 SUN Microsystems. All Rights Reserved.