ActiveIO - 1.0

Clover coverage report - ActiveIO - 1.0 Coverage timestamp: Fri Apr 22 2005 14:27:22 PDT FRAMES NO FRAMES |
file stats: | LOC: | 73 |  | Methods: | 5
| NCLOC: | 25 |  | Classes: | 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
Source file | Conditionals | Statements | Methods | TOTAL
CounterAsyncChannel.java | - | 0% | 0% | 0% |

1 |  |
     /**
2 |  |
      *
3 |  |
      * Copyright 2004 Hiram Chirino
4 |  |
      *
5 |  |
      *  Licensed under the Apache License, Version 2.0 (the "License");
6 |  |
      *  you may not use this file except in compliance with the License.
7 |  |
      *  You may obtain a copy of the License at
8 |  |
      *
9 |  |
      *     http://www.apache.org/licenses/LICENSE-2.0
10 |  |
      *
11 |  |
      *  Unless required by applicable law or agreed to in writing, software
12 |  |
      *  distributed under the License is distributed on an "AS IS" BASIS,
13 |  |
      *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 |  |
      *  See the License for the specific language governing permissions and
15 |  |
      *  limitations under the License.
16 |  |
      */
17 |  |
     package org.activeio.filter;
18 |  |
19 |  |
     import java.io.IOException;
20 |  |
21 |  |
     import org.activeio.AsynchChannel;
22 |  |
     import org.activeio.FilterAsynchChannel;
23 |  |
     import org.activeio.Packet;
24 |  |
25 |  |
26 |  |
     /**
27 |  |
      * A CounterAsyncChannel is a simple {@see org.activeio.AsynchChannelFilter}
28 |  |
      * that counts the number bytes that been sent down and up through the channel.
29 |  |
      *
30 |  |
      * The {@see org.activeio.counter.CounterAttribueEnum.COUNTER_INBOUND_COUNT}
31 |  |
      * and {@see org.activeio.counter.CounterAttribueEnum.COUNTER_OUTBOUND_COUNT}
32 |  |
      * attributes can be used to find query the channel to get the current inbound and outbound
33 |  |
      * byte counts.
34 |  |
      *
35 |  |
      * @version $Revision$
36 |  |
      */
37 |  |
     final public class CounterAsyncChannel extends FilterAsynchChannel {
38 |  |
39 |  |
         long inBoundCounter = 0;
40 |  |
41 |  |
         long outBoundCounter = 0;
42 |  |
43 |  |
         /**
44 |  |
          * @param next
45 |  |
          */
46 | 0 |
         public CounterAsyncChannel(AsynchChannel next) {
47 | 0 |
             super(next);
48 |  |
         }
49 |  |
50 |  |
         /**
51 |  |
          * @see org.activeio.FilterAsynchChannel#onPacket(org.activeio.channel.Packet)
52 |  |
          */
53 | 0 |
         public void onPacket(Packet packet) {
54 | 0 |
             inBoundCounter += packet.remaining();
55 | 0 |
             super.onPacket(packet);
56 |  |
         }
57 |  |
58 |  |
         /**
59 |  |
          * @see org.activeio.FilterAsynchChannel#write(org.activeio.channel.Packet)
60 |  |
          */
61 | 0 |
         public void write(Packet packet) throws IOException {
62 | 0 |
             outBoundCounter += packet.position();
63 | 0 |
             super.write(packet);
64 |  |
         }
65 |  |
66 | 0 |
         public long getInBoundCounter() {
67 | 0 |
             return inBoundCounter;
68 |  |
         }
69 |  |
70 | 0 |
         public long getOutBoundCounter() {
71 | 0 |
             return outBoundCounter;
72 |  |
         }
73 |  |
     }