## com.sun.grizzly.async
Interface AsyncReadCallbackHandler

    public interface AsyncReadCallbackHandler

Callback handler interface, used by `AsyncQueueReader` to notify custom code either about completion of specific `ByteBuffer` reading or about IO problem, which occured when reading data to a `ByteBuffer`

Author:
  Alexey Stashok

Method Summary
`void` `onIOException(IOException ioException, SelectionKey key, ByteBuffer buffer, Queue<AsyncReadQueueRecord> remainingQueue)` Method will be called by `AsyncQueueReader`, if IO error occured when reading from the `SelectableChannel`, which is associated with `SelectionKey`
`void` `onReadCompleted(SelectionKey key, SocketAddress srcAddress, ByteBuffer buffer)` Method will be called by `AsyncQueueReader`, if data was read to the `ByteBuffer` from the `SelectableChannel`, associated with `SelectionKey`, and read data confirms to the user-specific condition (if any was set).

Method Detail

### onReadCompleted

    void onReadCompleted(SelectionKey key,
                         SocketAddress srcAddress,
                         ByteBuffer buffer)

  Method will be called by `AsyncQueueReader`, if data was read to the `ByteBuffer` from the `SelectableChannel`, associated with `SelectionKey`, and read data confirms to the user-specific condition (if any was set).

  Parameters:
    `key` - `SelectionKey`, associated with input `SelectableChannel`
    `srcAddress` - sender's `SocketAddress`
    `buffer` - `ByteBuffer` with read data

### onIOException

    void onIOException(IOException ioException,
                       SelectionKey key,
                       ByteBuffer buffer,
                       Queue<AsyncReadQueueRecord> remainingQueue)

  Method will be called by `AsyncQueueReader`, if IO error occured when reading from the `SelectableChannel`, which is associated with `SelectionKey`

  Parameters:
    `ioException` - occured `IOException`
    `key` - `SelectionKey`, associated with input `SelectableChannel`
    `buffer` - `ByteBuffer`, which supposed to be used for asynchronous reading. `ByteBuffer` could contain some data, which was successfully read before error occured

Copyright © 2008 SUN Microsystems. All Rights Reserved.