Clover coverage report - ActiveIO - 1.0 Coverage timestamp: Fri Apr 22 2005 14:27:22 PDT FRAMES NO FRAMES |
file stats: | LOC: | 152 |  | Methods: | 26
| NCLOC: | 84 |  | 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
EOSPacket.java | 0% | 18.2% | 11.5% | 14% |

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 is used to represent the end of a stream.
27 |  |
      *
28 |  |
      * @version $Revision$
29 |  |
      */
30 |  |
     final public class EOSPacket implements Packet {
31 |  |
32 |  |
         static final public EOSPacket EOS_PACKET = new EOSPacket();
33 |  |
34 | 26 |
         private EOSPacket() {
35 |  |
         }
36 |  |
37 | 0 |
         public void writeTo(OutputStream out) throws IOException {
38 |  |
         }
39 | 0 |
         public void writeTo(DataOutput out) throws IOException {
40 |  |
         }
41 |  |
42 | 0 |
         public int position() {
43 | 0 |
             return 1;
44 |  |
         }
45 |  |
46 | 0 |
         public void position(int position) {
47 |  |
         }
48 |  |
49 | 0 |
         public int limit() {
50 | 0 |
             return 0;
51 |  |
         }
52 |  |
53 | 0 |
         public void limit(int limit) {
54 |  |
         }
55 |  |
56 | 0 |
         public void flip() {
57 |  |
         }
58 |  |
59 | 0 |
         public int remaining() {
60 | 0 |
             return -1;
61 |  |
         }
62 |  |
63 | 0 |
         public void rewind() {
64 |  |
         }
65 |  |
66 | 18 |
         public boolean hasRemaining() {
67 | 18 |
             return false;
68 |  |
         }
69 |  |
70 | 0 |
         public void clear() {
71 |  |
         }
72 |  |
73 | 0 |
         public int capacity() {
74 | 0 |
             return 0;
75 |  |
         }
76 |  |
77 | 0 |
         public Packet slice() {
78 | 0 |
             return this;
79 |  |
         }
80 |  |
81 | 0 |
         public Packet duplicate() {
82 | 0 |
             return this;
83 |  |
         }
84 |  |
85 | 4 |
         public Object duplicate(ClassLoader cl) throws IOException {
86 | 4 |
             try {
87 | 4 |
                 Class clazz = cl.loadClass(EOSPacket.class.getName());
88 | 4 |
                 return clazz.getField("EOS_PACKET").get(null);
89 |  |
             } catch (Throwable e) {
90 | 0 |
                 throw (IOException)new IOException("Could not duplicate packet in a different classloader: "+e).initCause(e);
91 |  |
             }
92 |  |
         }
93 |  |
94 |  |
         /**
95 |  |
          * @see org.activeio.Packet#read()
96 |  |
          */
97 | 0 |
         public int read() {
98 | 0 |
             return -1;
99 |  |
         }
100 |  |
101 |  |
         /**
102 |  |
          * @see org.activeio.Packet#read(byte[], int, int)
103 |  |
          */
104 | 0 |
         public int read(byte[] data, int offset, int length) {
105 | 0 |
             return -1;
106 |  |
         }
107 |  |
108 |  |
         /**
109 |  |
          * @see org.activeio.Packet#write(int)
110 |  |
          */
111 | 0 |
         public boolean write(int data) {
112 | 0 |
             return false;
113 |  |
         }
114 |  |
115 |  |
         /**
116 |  |
          * @see org.activeio.Packet#write(byte[], int, int)
117 |  |
          */
118 | 0 |
         public int write(byte[] data, int offset, int length) {
119 | 0 |
             return -1;
120 |  |
         }
121 |  |
122 | 0 |
         public ByteSequence asByteSequence() {
123 | 0 |
             return EmptyPacket.EMPTY_BYTE_SEQUENCE;
124 |  |
         }
125 |  |
126 | 0 |
         public byte[] sliceAsBytes() {
127 | 0 |
             return EmptyPacket.EMPTY_BYTE_ARRAY;
128 |  |
         }
129 |  |
130 |  |
         /**
131 |  |
          * @param dest
132 |  |
          * @return the number of bytes read into the dest.
133 |  |
          */
134 | 0 |
         public int read(Packet dest) {
135 | 0 |
             return 0;
136 |  |
         }
137 |  |
138 | 0 |
         public String toString() {
139 | 0 |
             return "{position="+position()+",limit="+limit()+",capacity="+capacity()+"}";
140 |  |
         }
141 |  |
142 | 0 |
         public Object narrow(Class target) {
143 | 0 |
             if( target.isAssignableFrom(getClass()) ) {
144 | 0 |
                 return this;
145 |  |
             }
146 | 0 |
             return null;
147 |  |
         }
148 |  |
149 | 0 |
         public void dispose() {
150 |  |
         }
151 |  |
152 |  |
     }