Coverage report

  %line %branch
org.apache.commons.net.io.CopyStreamEvent
0% 
0% 

 1  
 /*
 2  
  * Copyright 2001-2005 The Apache Software Foundation
 3  
  *
 4  
  * Licensed under the Apache License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  *
 8  
  *     http://www.apache.org/licenses/LICENSE-2.0
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 15  
  */
 16  
 package org.apache.commons.net.io;
 17  
 
 18  
 import java.util.EventObject;
 19  
 
 20  
 /**
 21  
  * A CopyStreamEvent is triggered after every write performed by a
 22  
  * stream copying operation.  The event stores the number of bytes
 23  
  * transferred by the write triggering the event as well as the total
 24  
  * number of bytes transferred so far by the copy operation.
 25  
  * <p>
 26  
  * <p>
 27  
  * @see CopyStreamListener
 28  
  * @see CopyStreamAdapter
 29  
  * @see Util
 30  
  * @author <a href="mailto:savarese@apache.org">Daniel F. Savarese</a>
 31  
  * @version $Id: CopyStreamEvent.java 165675 2005-05-02 20:09:55Z rwinston $
 32  
  */
 33  
 public class CopyStreamEvent extends EventObject
 34  
 {
 35  
     /**
 36  
      * Constant used to indicate the stream size is unknown.
 37  
      */
 38  
     public static final long UNKNOWN_STREAM_SIZE = -1;
 39  
 
 40  
     private int bytesTransferred;
 41  
     private long totalBytesTransferred;
 42  
     private long streamSize;
 43  
 
 44  
     /**
 45  
      * Creates a new CopyStreamEvent instance.
 46  
      * @param source  The source of the event.
 47  
      * @param totalBytesTransferred The total number of bytes transferred so
 48  
      *   far during a copy operation.
 49  
      * @param bytesTransferred  The number of bytes transferred during the
 50  
      *        write that triggered the CopyStreamEvent.
 51  
      * @param streamSize  The number of bytes in the stream being copied.
 52  
      *          This may be set to <code>UNKNOWN_STREAM_SIZE</code> if the
 53  
      *          size is unknown.
 54  
      */
 55  
     public CopyStreamEvent(Object source, long totalBytesTransferred,
 56  
                            int bytesTransferred, long streamSize)
 57  
     {
 58  0
         super(source);
 59  0
         this.bytesTransferred = bytesTransferred;
 60  0
         this.totalBytesTransferred = totalBytesTransferred;
 61  0
         this.streamSize = streamSize;
 62  0
     }
 63  
 
 64  
     /**
 65  
      * Returns the number of bytes transferred by the write that triggered
 66  
      * the event.
 67  
      * @return The number of bytes transferred by the write that triggered
 68  
      * the vent.
 69  
      */
 70  
     public int getBytesTransferred()
 71  
     {
 72  0
         return bytesTransferred;
 73  
     }
 74  
 
 75  
     /**
 76  
      * Returns the total number of bytes transferred so far by the copy
 77  
      * operation.
 78  
      * @return The total number of bytes transferred so far by the copy
 79  
      * operation.
 80  
      */
 81  
     public long getTotalBytesTransferred()
 82  
     {
 83  0
         return totalBytesTransferred;
 84  
     }
 85  
 
 86  
     /**
 87  
      * Returns the size of the stream being copied.
 88  
      * This may be set to <code>UNKNOWN_STREAM_SIZE</code> if the
 89  
      * size is unknown.
 90  
      * @return The size of the stream being copied.
 91  
      */
 92  
     public long getStreamSize()
 93  
     {
 94  0
         return streamSize;
 95  
     }
 96  
 }

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