XNIO version 1.2.1.GA

org.jboss.xnio
Class DelegatingIoHandler<T extends Channel>

java.lang.Object
  extended by org.jboss.xnio.DelegatingIoHandler<T>
All Implemented Interfaces:
IoHandler<T>, IoReadHandler<T>, IoWriteHandler<T>

public abstract class DelegatingIoHandler<T extends Channel>
extends Object
implements IoHandler<T>

A base delegating I/O handler. Implementors may separately set read and write handlers. Ideal for state pattern handlers for example.

Since:
1.2

Constructor Summary
DelegatingIoHandler()
           
 
Method Summary
protected  IoReadHandler<T> getReadHandler()
          Get the read handler.
protected  IoWriteHandler<T> getWriteHandler()
          Get the write handler.
 void handleReadable(T channel)
          Handles a readable notification by delegating it to the set read handler, if there is one; otherwise the notification is ignored.
 void handleWritable(T channel)
          Handles a writable notification by delegating it to the set write handler, if there is one; otherwise the notification is ignored.
protected  void setReadHandler(IoReadHandler<T> readHandler)
          Set the read handler.
protected  void setWriteHandler(IoWriteHandler<T> writeHandler)
          Set the write handler.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jboss.xnio.IoHandler
handleClosed, handleOpened
 

Constructor Detail

DelegatingIoHandler

public DelegatingIoHandler()
Method Detail

handleReadable

public final void handleReadable(T channel)
Handles a readable notification by delegating it to the set read handler, if there is one; otherwise the notification is ignored.

Specified by:
handleReadable in interface IoReadHandler<T extends Channel>
Parameters:
channel - the channel that is readable

handleWritable

public final void handleWritable(T channel)
Handles a writable notification by delegating it to the set write handler, if there is one; otherwise the notification is ignored.

Specified by:
handleWritable in interface IoWriteHandler<T extends Channel>
Parameters:
channel - the channel that is writable

getReadHandler

protected IoReadHandler<T> getReadHandler()
Get the read handler.

Returns:
the read handler

setReadHandler

protected void setReadHandler(IoReadHandler<T> readHandler)
Set the read handler.

Parameters:
readHandler - the new read handler

getWriteHandler

protected IoWriteHandler<T> getWriteHandler()
Get the write handler.

Returns:
the write handler

setWriteHandler

protected void setWriteHandler(IoWriteHandler<T> writeHandler)
Set the write handler.

Parameters:
writeHandler - the new write handler

XNIO version 1.2.1.GA

Copyright © 2008 JBoss, a division of Red Hat, Inc.