org.jboss.soa.esb.util
Class FileUtil

java.lang.Object
  extended by org.jboss.soa.esb.util.FileUtil

public class FileUtil
extends java.lang.Object

Common file utility functions.

Author:
kevin

Constructor Summary
FileUtil()
           
 
Method Summary
static byte[] readFile(java.io.File file)
          Read the contents of a file and return it as a byte array.
static java.lang.String readTextFile(java.io.File file)
          Read the file into a String.
static boolean renameTo(java.io.File from, java.io.File to)
          Attempt to rename a file
 
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

renameTo

public static boolean renameTo(java.io.File from,
                               java.io.File to)
Attempt to rename a file

Parameters:
from - The original file
to - The destination file.
Returns:
true if the rename succeeded, false otherwise

readTextFile

public static java.lang.String readTextFile(java.io.File file)
                                     throws java.io.IOException
Read the file into a String.

Parameters:
file - - the file to be read
Returns:
String with the content of the file
Throws:
java.io.IOException - - when we can't read the file

readFile

public static byte[] readFile(java.io.File file)
                       throws java.io.IOException
Read the contents of a file and return it as a byte array.

Parameters:
file - The file to be read.
Returns:
The file contents.
Throws:
java.io.IOException - Error reading the file.