Coverage report

  %line %branch
be.dvw.administration.util.FileUtils
82% 
90% 

 1  
 package be.dvw.administration.util;
 2  
 
 3  
 import java.io.*;
 4  
 import java.net.URL;
 5  
 
 6  
 /**
 7  
  * This class allows to safely load files from anywhere in the classpath
 8  
  */
 9  0
 public class FileUtils
 10  
 {
 11  
 	public static InputStream getFileInputStream(String filePath) throws IOException
 12  
 	{
 13  30
 		InputStream is =  new FileInputStream (getFile(filePath));
 14  30
 		if (is == null)
 15  
 		{
 16  0
 			throw new IOException("Unable to read file " + filePath);
 17  
 		}
 18  30
 		return is;
 19  
 	}
 20  
 
 21  
 	public static InputStreamReader getInputStreamReader(String filePath) throws IOException
 22  
 	{
 23  24
 		InputStream is = getFileInputStream(filePath);
 24  24
 		return new InputStreamReader(is);
 25  
 
 26  
 	}
 27  
 
 28  
 	public static File getFile(String filePath)
 29  
 	{
 30  78
 		URL url = getUrl(filePath);
 31  78
 		return new File ( url.getFile() );
 32  
 	}
 33  
 
 34  
 	public static URL getUrl(String filePath)
 35  
 	{
 36  78
 		ClassLoader cl = Thread.currentThread().getContextClassLoader();
 37  78
 		return cl.getResource( filePath );
 38  
 	}
 39  
 
 40  
 }

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