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

Field Summary
static java.lang.String classInstanceUUID
           
 
Constructor Summary
FileUtil()
           
 
Method Summary
static boolean moveFile(java.io.File from, java.io.File to)
          Moves a "from" file to a "to" file through copying of the file contents.
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
 

Field Detail

classInstanceUUID

public static final java.lang.String classInstanceUUID
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

moveFile

public static boolean moveFile(java.io.File from,
                               java.io.File to)
Moves a "from" file to a "to" file through copying of the file contents.

This is not a file rename.

Parameters:
from - The source file.
to - The target file.
Returns:
True if the move was successful, otherwise false.

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.