Coverage report

  %line %branch
org.apache.jcs.admin.CountingOnlyOutputStream
100% 
100% 

 1  
 package org.apache.jcs.admin;
 2  
 
 3  
 /*
 4  
  * Licensed to the Apache Software Foundation (ASF) under one
 5  
  * or more contributor license agreements.  See the NOTICE file
 6  
  * distributed with this work for additional information
 7  
  * regarding copyright ownership.  The ASF licenses this file
 8  
  * to you under the Apache License, Version 2.0 (the
 9  
  * "License"); you may not use this file except in compliance
 10  
  * with the License.  You may obtain a copy of the License at
 11  
  *
 12  
  *   http://www.apache.org/licenses/LICENSE-2.0
 13  
  *
 14  
  * Unless required by applicable law or agreed to in writing,
 15  
  * software distributed under the License is distributed on an
 16  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 17  
  * KIND, either express or implied.  See the License for the
 18  
  * specific language governing permissions and limitations
 19  
  * under the License.
 20  
  */
 21  
 
 22  
 import java.io.IOException;
 23  
 import java.io.OutputStream;
 24  
 
 25  
 /**
 26  
  * Keeps track of the number of bytes written to it, but doesn't write them anywhere.
 27  
  */
 28  40
 public class CountingOnlyOutputStream
 29  
     extends OutputStream
 30  
 {
 31  
     /** number of bytes passed through */
 32  
     private int count;
 33  
 
 34  
     /**
 35  
      * count as we write.
 36  
      * <p>
 37  
      * @param b
 38  
      * @throws IOException
 39  
      */
 40  
     public void write( byte[] b )
 41  
         throws IOException
 42  
     {
 43  8
         this.count += b.length;
 44  8
     }
 45  
 
 46  
     /**
 47  
      * count as we write.
 48  
      * <p>
 49  
      * @param b
 50  
      * @param off
 51  
      * @param len
 52  
      * @throws IOException
 53  
      */
 54  
     public void write( byte[] b, int off, class="keyword">int len )
 55  
         throws IOException
 56  
     {
 57  32
         this.count += len;
 58  32
     }
 59  
 
 60  
     /**
 61  
      * count as we write.
 62  
      * <p>
 63  
      * @param b
 64  
      * @throws IOException
 65  
      */
 66  
     public void write( int b )
 67  
         throws IOException
 68  
     {
 69  16
         this.count++;
 70  16
     }
 71  
 
 72  
     /**
 73  
      * The number of bytes that have passed through this stream.
 74  
      * <p>
 75  
      * @return int
 76  
      */
 77  
     public int getCount()
 78  
     {
 79  48
         return this.count;
 80  
     }
 81  
 }

This report is generated by jcoverage, Maven and Maven JCoverage Plugin.