View Javadoc

1   /*
2    *   @(#) $Id: IoHandlerAdapter.java 210062 2005-07-11 03:52:38Z trustin $
3    *
4    *   Copyright 2004 The Apache Software Foundation
5    *
6    *   Licensed under the Apache License, Version 2.0 (the "License");
7    *   you may not use this file except in compliance with the License.
8    *   You may obtain a copy of the License at
9    *
10   *       http://www.apache.org/licenses/LICENSE-2.0
11   *
12   *   Unless required by applicable law or agreed to in writing, software
13   *   distributed under the License is distributed on an "AS IS" BASIS,
14   *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   *   See the License for the specific language governing permissions and
16   *   limitations under the License.
17   *
18   */
19  package org.apache.mina.io;
20  
21  import org.apache.mina.common.ByteBuffer;
22  import org.apache.mina.common.IdleStatus;
23  import org.apache.mina.util.SessionUtil;
24  
25  /***
26   * An abstract adapter class for {@link IoHandler}.  You can extend this class
27   * and selectively override required event handler methods only.  All methods
28   * do nothing by default.
29   * <p>
30   * Please refer to
31   * <a href="../../../../../xref-examples/org/apache/mina/examples/netcat/NetCatProtocolHandler.html"><code>NetCatProtocolHandler</code></a>
32   * example. 
33   * 
34   * @author Trustin Lee (trustin@apache.org)
35   * @version $Rev: 210062 $, $Date: 2005-07-11 12:52:38 +0900 $
36   */
37  public class IoHandlerAdapter implements IoHandler
38  {
39      public void sessionCreated( IoSession session ) throws Exception
40      {
41          SessionUtil.initialize( session );
42      }
43  
44      public void sessionOpened( IoSession session ) throws Exception
45      {
46      }
47  
48      public void sessionClosed( IoSession session ) throws Exception
49      {
50      }
51  
52      public void sessionIdle( IoSession session, IdleStatus status ) throws Exception
53      {
54      }
55  
56      public void exceptionCaught( IoSession session, Throwable cause ) throws Exception
57      {
58      }
59  
60      public void dataRead( IoSession session, ByteBuffer buf ) throws Exception
61      {
62      }
63  
64      public void dataWritten( IoSession session, Object marker ) throws Exception
65      {
66      }
67  }