org.af.commons.io
Class FileTransfer

java.lang.Object
  extended by org.af.commons.io.FileTransfer

public class FileTransfer
extends Object

Class for copying and moving files and resources.


Constructor Summary
FileTransfer()
           
 
Method Summary
static void copyFile(File in, File out)
          Copy a file.
 File copyFileToLocalDir(String name, File localDir)
           
 File copyFileToLocalDir(String path, String name, File localDir)
           
static File copyResourceToLocalDir(URL resource, String name, File localDir)
           
static FileTransfer getFileTransfer()
           
 void moveFile(File f, File targetDir)
          Move a file.
 void moveFile(File f, File targetDir, String name)
          Move a file.
 void moveFile(File f, File targetDir, String name, boolean overwrite)
          Move a file.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileTransfer

public FileTransfer()
Method Detail

getFileTransfer

public static FileTransfer getFileTransfer()

copyFileToLocalDir

public File copyFileToLocalDir(String name,
                               File localDir)
                        throws IOException
Throws:
IOException

copyFileToLocalDir

public File copyFileToLocalDir(String path,
                               String name,
                               File localDir)
                        throws IOException
Throws:
IOException

copyResourceToLocalDir

public static File copyResourceToLocalDir(URL resource,
                                          String name,
                                          File localDir)
                                   throws IOException
Throws:
IOException

copyFile

public static void copyFile(File in,
                            File out)
                     throws IOException
Copy a file. If the destination is already existing, it will be overwritten.

Parameters:
in - file source
out - file destination
Throws:
IOException

moveFile

public void moveFile(File f,
                     File targetDir,
                     String name)
              throws IOException
Move a file. If the target exists, it will be overwritten.

Parameters:
f - file to move
targetDir - directory to that the file should be moved
name - new name of the file
Throws:
IOException

moveFile

public void moveFile(File f,
                     File targetDir,
                     String name,
                     boolean overwrite)
              throws IOException
Move a file.

Parameters:
f - file to move
targetDir - directory to that the file should be moved
name - new name of the file
overwrite - should an existing file be overwritten?
Throws:
IOException

moveFile

public void moveFile(File f,
                     File targetDir)
              throws IOException
Move a file. If the target exists, it will be overwritten.

Parameters:
f - file to move
targetDir - directory to that the file should be moved
Throws:
IOException