com.massimo.tools.scriptrunner.utils
Class FileUtils

java.lang.Object
  extended by com.massimo.tools.scriptrunner.utils.FileUtils

public class FileUtils
extends Object

Some simple file utilities.


Field Summary
static int READ_BUFFER_SIZE
           
 
Constructor Summary
FileUtils()
           
 
Method Summary
static String readFile(File file)
           
static String readFile(InputStream in)
           
static String resolvePath(String base, String path)
           
static void writeFile(File file, String text)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

READ_BUFFER_SIZE

public static final int READ_BUFFER_SIZE
See Also:
Constant Field Values
Constructor Detail

FileUtils

public FileUtils()
Method Detail

readFile

public static String readFile(File file)
                       throws IOException
Parameters:
file -
Returns:
File contents as a String
Throws:
IOException
FileNotFoundException

readFile

public static String readFile(InputStream in)
                       throws IOException
Parameters:
in -
Returns:
InputStream contents as a String
Throws:
IOException
FileNotFoundException

resolvePath

public static String resolvePath(String base,
                                 String path)
Parameters:
base - Possible base for a relative path
path - A relative or absolute path
Returns:
path, if it is absolute, or a combined path if the file exists
Throws:
IllegalArgumentException - if not file is found

writeFile

public static void writeFile(File file,
                             String text)
                      throws IOException
Parameters:
file -
text - File contents as a String
Throws:
IOException