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: | 138 |  | Methods: | 25
| NCLOC: | 86 |  | 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
FilterPacket.java | 50% | 22.2% | 20% | 22.2% |

1 |  |
     /**
2 |  |
      *
3 |  |
      * Copyright 2004 Hiram Chirino
4 |  |
      *
5 |  |
      * Licensed under the Apache License, Version 2.0 (the "License"); you may not
6 |  |
      * use this file except in compliance with the License. You may obtain a copy of
7 |  |
      * 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, WITHOUT
13 |  |
      * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 |  |
      * License for the specific language governing permissions and limitations under
15 |  |
      * the License.
16 |  |
      */
17 |  |
     package org.activeio.packet;
18 |  |
19 |  |
     import java.io.DataOutput;
20 |  |
     import java.io.IOException;
21 |  |
     import java.io.OutputStream;
22 |  |
23 |  |
     import org.activeio.Packet;
24 |  |
25 |  |
     /**
26 |  |
      * Provides a Packet implementation that filters operations to another packet.
27 |  |
      *
28 |  |
      * Used to make it easier to augment the {@see #narrow(Class)}method.
29 |  |
      *
30 |  |
      * @version $Revision$
31 |  |
      */
32 |  |
     public abstract class FilterPacket implements Packet {
33 |  |
         final protected Packet next;
34 |  |
35 | 4 |
         public FilterPacket(Packet next) {
36 | 4 |
             this.next = next;
37 |  |
         }
38 |  |
39 | 0 |
         public ByteSequence asByteSequence() {
40 | 0 |
             return next.asByteSequence();
41 |  |
         }
42 |  |
43 | 0 |
         public int capacity() {
44 | 0 |
             return next.capacity();
45 |  |
         }
46 |  |
47 | 0 |
         public void clear() {
48 | 0 |
             next.clear();
49 |  |
         }
50 |  |
51 | 4 |
         public void flip() {
52 | 4 |
             next.flip();
53 |  |
         }
54 |  |
55 | 0 |
         public boolean hasRemaining() {
56 | 0 |
             return next.hasRemaining();
57 |  |
         }
58 |  |
59 | 0 |
         public int limit() {
60 | 0 |
             return next.limit();
61 |  |
         }
62 |  |
63 | 0 |
         public void limit(int limit) {
64 | 0 |
             next.limit(limit);
65 |  |
         }
66 |  |
67 | 4 |
         public Object narrow(Class target) {
68 | 4 |
             if( target.isAssignableFrom(getClass()) ) {
69 | 0 |
                 return this;
70 |  |
             }
71 | 4 |
             return next.narrow(target);
72 |  |
         }
73 |  |
74 | 0 |
         public int position() {
75 | 0 |
             return next.position();
76 |  |
         }
77 |  |
78 | 0 |
         public void position(int position) {
79 | 0 |
             next.position(position);
80 |  |
         }
81 |  |
82 | 0 |
         public int read() {
83 | 0 |
             return next.read();
84 |  |
         }
85 |  |
86 | 0 |
         public int read(byte[] data, int offset, int length) {
87 | 0 |
             return next.read(data, offset, length);
88 |  |
         }
89 |  |
90 | 0 |
         public int read(Packet dest) {
91 | 0 |
             return next.read(dest);
92 |  |
         }
93 |  |
94 | 24 |
         public int remaining() {
95 | 24 |
             return next.remaining();
96 |  |
         }
97 |  |
98 | 0 |
         public void rewind() {
99 | 0 |
             next.rewind();
100 |  |
         }
101 |  |
102 | 0 |
         public byte[] sliceAsBytes() {
103 | 0 |
             return next.sliceAsBytes();
104 |  |
         }
105 |  |
106 | 18 |
         public int write(byte[] data, int offset, int length) {
107 | 18 |
             return next.write(data, offset, length);
108 |  |
         }
109 |  |
110 | 0 |
         public boolean write(int data) {
111 | 0 |
             return next.write(data);
112 |  |
         }
113 |  |
114 | 0 |
         public void writeTo(OutputStream out) throws IOException {
115 | 0 |
             next.writeTo(out);
116 |  |
         }
117 | 0 |
         public void writeTo(DataOutput out) throws IOException {
118 | 0 |
             next.writeTo(out);
119 |  |
         }
120 |  |
121 | 0 |
         public Object duplicate(ClassLoader cl) throws IOException {
122 | 0 |
             return next.duplicate(cl);
123 |  |
         }
124 |  |
125 | 0 |
         public Packet duplicate() {
126 | 0 |
             return filter(next.duplicate());
127 |  |
         }
128 |  |
129 | 0 |
         public Packet slice() {
130 | 0 |
             return filter(next.slice());
131 |  |
         }
132 |  |
133 | 0 |
         public void dispose() {
134 | 0 |
             next.dispose();
135 |  |
         }
136 |  |
137 |  |
         abstract public Packet filter(Packet packet);
138 |  |
     }