com.quadrique.jbuildingblocks.core.io.file
Class JbbFile

java.lang.Object
  extended by com.quadrique.jbuildingblocks.core.io.file.JbbFile

public class JbbFile
extends Object

This class provides goodies to manipulate File(s)

Version:
1.0.0
Author:
Hervé Rivere

Method Summary
static void copyTree(File zSourceFolder, File zDestFolder)
          Copy a folder and all its sub folders to another location
static void deleteTree(File zStartFolder, boolean zRemoveSubFolders)
          Delete a folder and all its sub folders and their content.
static ArrayList<File> findFiles(File zStartFolder, ArrayList<String> zFileStartsWith, ArrayList<String> zFileEndsWith, boolean zScanSubFolders)
           
static List<File> geDirListing(File aStartingDir, boolean recursive)
          Recursively (optional) walk a directory tree and return a List of all directories found; the List is sorted using File.compareTo.
static List<File> getFileListing(File aStartingDir, boolean recursive)
          Recursively (optional) walk a directory tree and return a List of all Files found; the List is sorted using File.compareTo.
static JbbFile newInstance()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

newInstance

public static JbbFile newInstance()
Returns:
a new instance

copyTree

public static void copyTree(File zSourceFolder,
                            File zDestFolder)
                     throws Exception
Copy a folder and all its sub folders to another location

Parameters:
zSourceFolder -
zDestFolder -
Throws:
Exception

deleteTree

public static void deleteTree(File zStartFolder,
                              boolean zRemoveSubFolders)
                       throws Exception
Delete a folder and all its sub folders and their content.

Parameters:
zStartFolder - The folder to start with. This folder and all its content will be removed.
zRemoveSubFolders - Set to true to delete all sub folders and their content.
Throws:
Exception

findFiles

public static ArrayList<File> findFiles(File zStartFolder,
                                        ArrayList<String> zFileStartsWith,
                                        ArrayList<String> zFileEndsWith,
                                        boolean zScanSubFolders)
                                 throws Exception
Parameters:
zStartFolder -
zFileStartsWith -
zFileEndsWith -
Returns:
list of File objects
Throws:
Exception

getFileListing

public static List<File> getFileListing(File aStartingDir,
                                        boolean recursive)
                                 throws FileNotFoundException
Recursively (optional) walk a directory tree and return a List of all Files found; the List is sorted using File.compareTo.

Parameters:
aStartingDir - is a valid directory, which can be read.
recursive - Set to true if you want sub folders to be included
Throws:
FileNotFoundException

geDirListing

public static List<File> geDirListing(File aStartingDir,
                                      boolean recursive)
                               throws FileNotFoundException
Recursively (optional) walk a directory tree and return a List of all directories found; the List is sorted using File.compareTo.

Parameters:
aStartingDir - is a valid directory, which can be read.
recursive - Set to true if you want sub folders to be included
Throws:
FileNotFoundException


Copyright © 2001-2008 Quadrique Corporation. All Rights Reserved.