org.openoffice.ide.eclipse.core.utils
Class FileHelper

java.lang.Object
  extended by org.openoffice.ide.eclipse.core.utils.FileHelper

public class FileHelper
extends java.lang.Object

Utility class for file handling.

Author:
cedricbosdo

Constructor Summary
FileHelper()
           
 
Method Summary
static void copyFile(java.io.File pSrc, java.io.File pDst, boolean pForce)
          Copy the file src into the file dst.
static void move(java.io.File pSrc, java.io.File pDst, boolean pForce)
          Moves the src directory or file to the dst container.
static void remove(java.io.File pFile)
          Removes a file or directory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileHelper

public FileHelper()
Method Detail

move

public static void move(java.io.File pSrc,
                        java.io.File pDst,
                        boolean pForce)
                 throws java.io.IOException
Moves the src directory or file to the dst container.

Parameters:
pSrc - the file or directory to move
pDst - the destination directory
pForce - if set to true, overwrites the existing files
Throws:
java.io.IOException - is thrown when one of the parameters is null or the underlying file doesn't exists. This exception can also be thrown if the writing rights are missing on dst

copyFile

public static void copyFile(java.io.File pSrc,
                            java.io.File pDst,
                            boolean pForce)
                     throws java.io.IOException
Copy the file src into the file dst. If the dst file already exists, it will be deleted before to start copying if force is set to true, otherwise nothing will be done.

Parameters:
pSrc - the original file
pDst - the file to create
pForce - overwrite the existing destination if any
Throws:
java.io.IOException - is thrown if
  • the src file is null or isn't readable,
  • dst is null
  • the writing process fails

remove

public static void remove(java.io.File pFile)
Removes a file or directory.

Parameters:
pFile - the file or directory to remove