org.apache.mina.examples.echoserver
Class EchoProtocolHandler

java.lang.Object
  extended by org.apache.mina.io.IoHandlerAdapter
      extended by org.apache.mina.examples.echoserver.EchoProtocolHandler
All Implemented Interfaces:
IoHandler

public class EchoProtocolHandler
extends IoHandlerAdapter

IoHandler implementation for echo server.

Version:
$Rev: 332218 $, $Date: 2005-11-10 12:52:42 +0900 $,
Author:
The Apache Directory Project (dev@directory.apache.org)

Constructor Summary
EchoProtocolHandler()
           
 
Method Summary
 void dataRead(IoSession session, ByteBuffer rb)
          Invoked when data is read from the connection.
 void exceptionCaught(IoSession session, Throwable cause)
          Invoked when any exception is thrown by user IoHandler implementation or by MINA.
 void sessionCreated(IoSession session)
          Invoked when the session is created.
 void sessionIdle(IoSession session, IdleStatus status)
          Invoked when the connection is idle.
 
Methods inherited from class org.apache.mina.io.IoHandlerAdapter
dataWritten, sessionClosed, sessionOpened
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EchoProtocolHandler

public EchoProtocolHandler()
Method Detail

sessionCreated

public void sessionCreated(IoSession session)
Description copied from interface: IoHandler
Invoked when the session is created. Initialize default socket parameters and user-defined attributes here.

Specified by:
sessionCreated in interface IoHandler
Overrides:
sessionCreated in class IoHandlerAdapter

sessionIdle

public void sessionIdle(IoSession session,
                        IdleStatus status)
Description copied from interface: IoHandler
Invoked when the connection is idle. Refer to IdleStatus. This method is not invoked if the transport type is UDP.

Specified by:
sessionIdle in interface IoHandler
Overrides:
sessionIdle in class IoHandlerAdapter

exceptionCaught

public void exceptionCaught(IoSession session,
                            Throwable cause)
Description copied from interface: IoHandler
Invoked when any exception is thrown by user IoHandler implementation or by MINA. If cause is instanceof IOException, MINA will close the connection automatically.

Specified by:
exceptionCaught in interface IoHandler
Overrides:
exceptionCaught in class IoHandlerAdapter

dataRead

public void dataRead(IoSession session,
                     ByteBuffer rb)
Description copied from interface: IoHandler
Invoked when data is read from the connection. You can access buf to get read data. buf returns to the internal buffer pool of MINA after this method is invoked, so please don't try to reuse it.

Specified by:
dataRead in interface IoHandler
Overrides:
dataRead in class IoHandlerAdapter


Copyright © 2004-2005 . All Rights Reserved.