org.objectweb.jonas_lib.files
Class FileUtils

java.lang.Object
  extended by org.objectweb.jonas_lib.files.FileUtils

public class FileUtils
extends Object

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

Author:
Florent Benoit

Method Summary
static void copyDirectory(File src, File dest)
          Copy a directory recursively
static void copyDirectory(String src, String dest)
          Copy a directory recursively
static void copyFile(File src, File dest)
          Copy a file
static void copyFile(String src, String dest)
          Copy a file
static boolean delete(File f)
           
static boolean delete(String path)
           
static void dump(InputStream in, File entryFile)
          Write the given input stream in the given file.
static String[] getFileList(File dir, String prefix, String suffix)
          return a list of files with this suffix in directory dstr
static void unpack(JarFile packedJar, 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
 

Method Detail

unpack

public static void unpack(JarFile packedJar,
                          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(InputStream in,
                        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(String src,
                            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(File src,
                            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(String path)
Parameters:
path - file/directory to be deleted
Returns:
true if deletion was OK

delete

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

copyDirectory

public static void copyDirectory(String src,
                                 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(File src,
                                 File dest)
                          throws FileUtilsException
Copy a directory recursively

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

getFileList

public static String[] getFileList(File dir,
                                   String prefix,
                                   String suffix)
return a list of files with this suffix in directory dstr



Copyright © 2007 OW2 Consortium. All Rights Reserved.