com.mockrunner.util.common
Class FileUtil

java.lang.Object
  extended by com.mockrunner.util.common.FileUtil

public class FileUtil
extends java.lang.Object


Constructor Summary
FileUtil()
           
 
Method Summary
static java.io.File findFile(java.lang.String fileName)
          Tries to open the file from its absolute or relative path.
static java.util.List getLinesFromFile(java.io.File file)
          Reads all lines from a text file and adds them to a List.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileUtil

public FileUtil()
Method Detail

getLinesFromFile

public static java.util.List getLinesFromFile(java.io.File file)
Reads all lines from a text file and adds them to a List.

Parameters:
file - the input file
Returns:
the List with the file lines

findFile

public static java.io.File findFile(java.lang.String fileName)
                             throws java.io.FileNotFoundException
Tries to open the file from its absolute or relative path. If the file doesn't exist, tries to load the file with getResource. Throws a FileNotFoundException if the file cannot be found.

Parameters:
fileName - the file name
Returns:
the file as reader
Throws:
java.io.FileNotFoundException - if the cannot be found