Coverage Report - org.mule.impl.model.streaming.CloseCountDownOutputStream
 
Classes in this File Line Coverage Branch Coverage Complexity
CloseCountDownOutputStream
0%
0/14
0%
0/2
1.2
 
 1  
 /*
 2  
  * $Id: CloseCountDownOutputStream.java 7963 2007-08-21 08:53:15Z dirk.olmes $
 3  
  * --------------------------------------------------------------------------------------
 4  
  * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
 5  
  *
 6  
  * The software in this package is published under the terms of the CPAL v1.0
 7  
  * license, a copy of which has been included with this distribution in the
 8  
  * LICENSE.txt file.
 9  
  */
 10  
 
 11  
 package org.mule.impl.model.streaming;
 12  
 
 13  
 import java.io.IOException;
 14  
 import java.io.OutputStream;
 15  
 
 16  
 import edu.emory.mathcs.backport.java.util.concurrent.CountDownLatch;
 17  
 
 18  
 /**
 19  
  * Decrements the latch on close.
 20  
  */
 21  
 public class CloseCountDownOutputStream extends OutputStream
 22  
 {
 23  
 
 24  
     private OutputStream delegate;
 25  
     private CountDownLatch latch;
 26  
 
 27  
     public CloseCountDownOutputStream(OutputStream delegate, CountDownLatch latch)
 28  0
     {
 29  0
         this.delegate = delegate;
 30  0
         this.latch = latch;
 31  0
     }
 32  
 
 33  
     public void write(int b) throws IOException
 34  
     {
 35  0
         delegate.write(b);
 36  0
     }
 37  
 
 38  
     public void write(byte b[]) throws IOException
 39  
     {
 40  0
         delegate.write(b);
 41  0
     }
 42  
 
 43  
     public void write(byte b[], int off, int len) throws IOException
 44  
     {
 45  0
         delegate.write(b, off, len);
 46  0
     }
 47  
 
 48  
     public void close() throws IOException
 49  
     {
 50  
         try
 51  
         {
 52  0
             delegate.close();
 53  
         }
 54  
         finally
 55  
         {
 56  0
             if (null != latch)
 57  
             {
 58  0
                 latch.countDown();
 59  
             }
 60  
         }
 61  0
     }
 62  
 
 63  
 }