View Javadoc

1   /*
2    *   @(#) $Id: IoFilterAdapter.java 332218 2005-11-10 03:52:42Z 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  
24  /***
25   * An abstract adapter class for {@link IoFilter}.  You can extend this
26   * class and selectively override required event filter methods only.  All
27   * methods forwards events to the next filter by default.
28   * <p>
29   * Please refer to
30   * <a href="../../../../../xref/org/apache/mina/io/filter/BlacklistFilter.html"><code>BlacklistFilter</code></a>
31   * example.
32   * 
33   * @author The Apache Directory Project (dev@directory.apache.org)
34   * @version $Rev: 332218 $, $Date: 2005-11-10 12:52:42 +0900 $
35   */
36  public class IoFilterAdapter implements IoFilter
37  {
38      public void sessionOpened( NextFilter nextFilter, IoSession session ) throws Exception
39      {
40          nextFilter.sessionOpened( session );
41      }
42  
43      public void sessionClosed( NextFilter nextFilter, IoSession session ) throws Exception
44      {
45          nextFilter.sessionClosed( session );
46      }
47  
48      public void sessionIdle( NextFilter nextFilter, IoSession session,
49                              IdleStatus status ) throws Exception
50      {
51          nextFilter.sessionIdle( session, status );
52      }
53  
54      public void exceptionCaught( NextFilter nextFilter, IoSession session,
55                                  Throwable cause ) throws Exception
56      {
57          nextFilter.exceptionCaught( session, cause );
58      }
59  
60      public void dataRead( NextFilter nextFilter, IoSession session,
61                           ByteBuffer buf ) throws Exception
62      {
63          nextFilter.dataRead( session, buf );
64      }
65  
66      public void dataWritten( NextFilter nextFilter, IoSession session,
67                              Object marker ) throws Exception
68      {
69          nextFilter.dataWritten( session, marker );
70      }
71  
72      public void filterWrite( NextFilter nextFilter, IoSession session,
73                               ByteBuffer buf, Object marker ) throws Exception
74      {
75          nextFilter.filterWrite( session, buf, marker );
76      }
77  }