Coverage Report - org.mule.transformer.simple.DataHandlerToInputStreamTransformer
 
Classes in this File Line Coverage Branch Coverage Complexity
DataHandlerToInputStreamTransformer
0%
0/7
N/A
0
 
 1  
 /*
 2  
  * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
 3  
  * The software in this package is published under the terms of the CPAL v1.0
 4  
  * license, a copy of which has been included with this distribution in the
 5  
  * LICENSE.txt file.
 6  
  */
 7  
 package org.mule.transformer.simple;
 8  
 
 9  
 import org.mule.api.transformer.TransformerException;
 10  
 import org.mule.transformer.AbstractDiscoverableTransformer;
 11  
 import org.mule.transformer.types.DataTypeFactory;
 12  
 
 13  
 import java.io.IOException;
 14  
 
 15  
 import javax.activation.DataHandler;
 16  
 
 17  
 public class DataHandlerToInputStreamTransformer extends AbstractDiscoverableTransformer
 18  
 {
 19  
 
 20  
     public DataHandlerToInputStreamTransformer()
 21  0
     {
 22  0
         registerSourceType(DataTypeFactory.create(DataHandler.class));
 23  0
         setReturnDataType(DataTypeFactory.INPUT_STREAM);
 24  0
     }
 25  
 
 26  
     @Override
 27  
     public Object doTransform(Object src, String enc) throws TransformerException
 28  
     {
 29  
         try
 30  
         {
 31  0
             return ((DataHandler) src).getInputStream();
 32  
         }
 33  0
         catch (IOException e)
 34  
         {
 35  0
             throw new TransformerException(this, e);
 36  
         }
 37  
     }
 38  
 }