org.objectweb.easybeans.util.files
Class FileUtils

java.lang.Object
  extended by org.objectweb.easybeans.util.files.FileUtils

public final class FileUtils
extends java.lang.Object

This class manages operation done many times on files, like copying them.

Author:
Florent Benoit

Field Summary
private static int BUFFER_SIZE
          Size of the buffer.
private static JLog logger
          Logger.
 
Constructor Summary
private FileUtils()
          Utility class, no public constructor.
 
Method Summary
static void copyDirectory(java.io.File src, java.io.File dest)
          Copy a directory recursively.
static void copyDirectory(java.lang.String src, java.lang.String dest)
          Copy a directory recursively.
static void copyFile(java.io.File src, java.io.File dest)
          Copy a file.
static void copyFile(java.lang.String src, java.lang.String dest)
          Copy a file.
static boolean delete(java.io.File f)
           
static boolean delete(java.lang.String path)
           
static void dump(java.io.InputStream in, java.io.File entryFile)
          Write the given input stream in the given file.
static void unpack(java.util.jar.JarFile packedJar, java.io.File dest)
          Unpack the source archive in a given directory and returns directory directory created.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BUFFER_SIZE

private static final int BUFFER_SIZE
Size of the buffer.

See Also:
Constant Field Values

logger

private static JLog logger
Logger.

Constructor Detail

FileUtils

private FileUtils()
Utility class, no public constructor.

Method Detail

unpack

public static void unpack(java.util.jar.JarFile packedJar,
                          java.io.File dest)
                   throws FileUtilsException
Unpack the source archive in a given directory and returns directory directory created.

Parameters:
packedJar - source JarFile to be unpacked
dest - the destination folder
Throws:
FileUtilsException - When unpack fails

dump

public static void dump(java.io.InputStream in,
                        java.io.File entryFile)
                 throws FileUtilsException
Write the given input stream in the given file.

Parameters:
in - the inputStream to copy.
entryFile - the file where the inputStream must be dumped.
Throws:
FileUtilsException - if the dump failed.

copyFile

public static void copyFile(java.lang.String src,
                            java.lang.String dest)
                     throws FileUtilsException
Copy a file.

Parameters:
src - source file
dest - dest file
Throws:
FileUtilsException - if the copy of the file failed

copyFile

public static void copyFile(java.io.File src,
                            java.io.File dest)
                     throws FileUtilsException
Copy a file.

Parameters:
src - source file
dest - dest file
Throws:
FileUtilsException - if the copy of the file failed

delete

public static boolean delete(java.lang.String path)
Parameters:
path - file/directory to be deleted
Returns:
true if deletion was OK

delete

public static boolean delete(java.io.File f)
Parameters:
f - file/directory to be deleted
Returns:
true if deletion was OK

copyDirectory

public static void copyDirectory(java.lang.String src,
                                 java.lang.String dest)
                          throws FileUtilsException
Copy a directory recursively.

Parameters:
src - source directory
dest - dest directory
Throws:
FileUtilsException - if the copy of the directory failed

copyDirectory

public static void copyDirectory(java.io.File src,
                                 java.io.File dest)
                          throws FileUtilsException
Copy a directory recursively.

Parameters:
src - source directory
dest - dest directory
Throws:
FileUtilsException - if the copy of the directory failed