TPTP 4.5.0 Platform Project
Public API Specification

org.eclipse.hyades.models.common.util
Class FileUtil

java.lang.Object
  extended by org.eclipse.hyades.models.common.util.FileUtil

public class FileUtil
extends java.lang.Object

This class implements some utility methods for dealing with java.io.File Some of the methods require JDK 1.4


Constructor Summary
FileUtil()
           
 
Method Summary
static boolean copyFile(java.lang.String srcFile, java.lang.String destFile)
          This method uses JDK 1.4 nio channels to perform fast file copy.
static void copyFileSafe(java.lang.String srcFile, java.lang.String destFile)
           
static boolean deltree(java.io.File root)
          This method attempts to delete the specified root file.
static java.io.File getTempDir()
          Returns the system temp directory.
static java.io.File[] listAllFiles(java.io.File srcDir)
          This method returns an array of File objects that are children of the specified srcDir, and that return true to the .isFile() method.
static void main(java.lang.String[] args)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileUtil

public FileUtil()
Method Detail

getTempDir

public static java.io.File getTempDir()
Returns the system temp directory.

Returns:
File

copyFile

public static boolean copyFile(java.lang.String srcFile,
                               java.lang.String destFile)
This method uses JDK 1.4 nio channels to perform fast file copy. Use copyFileSafe instead to receive exception if copy fails

Parameters:
srcFile -
destFile -
Returns:
true if the file copy was successful, false otherwise

copyFileSafe

public static void copyFileSafe(java.lang.String srcFile,
                                java.lang.String destFile)
                         throws java.io.IOException
Throws:
java.io.IOException

listAllFiles

public static java.io.File[] listAllFiles(java.io.File srcDir)
This method returns an array of File objects that are children of the specified srcDir, and that return true to the .isFile() method. In other words, the array is the result of a recursive search of the specified directory for all files (but not directories.)

Parameters:
srcDir -
Returns:
File[] All files that are children of the specified directory, or null if srcDir does not contain any files.

deltree

public static boolean deltree(java.io.File root)
This method attempts to delete the specified root file. If root is a directory with children, this method attempts for first recursively delete all children of root. If this methods returns true, then root has been deleted. If this method returns false, root has not been deleted, however if root is a directory, it is possible that some of its children were successfully deleted.

Parameters:
root -
Returns:
true if root has bene deleted, false otherwise.

main

public static void main(java.lang.String[] args)

TPTP 4.5.0 Platform Project
Public API Specification