it.geosolutions.tools.io.file
Class Copy

java.lang.Object
  extended by it.geosolutions.tools.io.file.Copy

public abstract class Copy
extends Object


Constructor Summary
Copy()
           
 
Method Summary
static List<FutureTask<File>> asynchCopyListFileToNFS(ExecutorService ex, List<File> list, File baseDestDir, int seconds)
          Copy a list of files asynchronously to a destination (which can be on nfs) each thread wait (at least) 'seconds' seconds for each file propagation.
static FutureTask<File> asynchFileCopyToNFS(ExecutorService ex, File source, File destination, int seconds)
           
static void copyFile(File sourceFile, File destinationFile)
          Copy the input file onto the output file using a default buffer size.
static void copyFile(File sourceFile, File destinationFile, int size)
          Copy the input file onto the output file using the specified buffer size.
static File copyFileToNFS(File source, File dest, boolean overwrite, int seconds)
          Copy a file (preserving data) to a destination (which can be on nfs) waiting (at least) 'seconds' seconds for its propagation.
static File copyFileToNFS(File source, File dest, int seconds)
          Copy a file (preserving data) to a destination (which can be on nfs) waiting (at least) 'seconds' seconds for its propagation.
static List<File> copyListFileToNFS(List<File> list, File baseDestDir, boolean serialOverwrite, int seconds)
           
static List<File> parallelCopyListFileToNFS(ExecutorService es, List<File> list, File baseDestDir, int seconds)
          Copy a list of files (preserving data) to a destination (which can be on nfs) waiting (at least) 'seconds' seconds for each file propagation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Copy

public Copy()
Method Detail

copyFile

public static void copyFile(File sourceFile,
                            File destinationFile)
                     throws IOException
Copy the input file onto the output file using a default buffer size.

Parameters:
sourceFile - the File to copy from.
destinationFile - the File to copy to.
Throws:
IOException - in case something bad happens.

copyFile

public static void copyFile(File sourceFile,
                            File destinationFile,
                            int size)
                     throws IOException
Copy the input file onto the output file using the specified buffer size.

Parameters:
sourceFile - the File to copy from.
destinationFile - the File to copy to.
size - buffer size.
Throws:
IOException - in case something bad happens.

copyFileToNFS

public static File copyFileToNFS(File source,
                                 File dest,
                                 boolean overwrite,
                                 int seconds)
Copy a file (preserving data) to a destination (which can be on nfs) waiting (at least) 'seconds' seconds for its propagation.

Parameters:
source -
dest -
overwrite - if false and destination exists() do not overwrite the file
seconds - to wait (maximum) for nfs propagate. If -1 no check is performed.
Returns:
the copied file if success, null if not.

copyFileToNFS

public static File copyFileToNFS(File source,
                                 File dest,
                                 int seconds)
Copy a file (preserving data) to a destination (which can be on nfs) waiting (at least) 'seconds' seconds for its propagation.

Parameters:
source -
dest -
seconds - to wait (maximum) for nfs propagate. If -1 no check is performed.
Returns:
the copied file if success, null if not.

copyListFileToNFS

public static List<File> copyListFileToNFS(List<File> list,
                                           File baseDestDir,
                                           boolean serialOverwrite,
                                           int seconds)
Parameters:
list -
baseDestDir -
serialOverwrite - if set true, overwrite is permitted (but parallel file transfer is disabled)
seconds -
Returns:

parallelCopyListFileToNFS

public static List<File> parallelCopyListFileToNFS(ExecutorService es,
                                                   List<File> list,
                                                   File baseDestDir,
                                                   int seconds)
Copy a list of files (preserving data) to a destination (which can be on nfs) waiting (at least) 'seconds' seconds for each file propagation.

Parameters:
es - The ExecutorService or null if you want to use a CachedThreadPool.
list -
baseDestDir -
overwrite - if false and destination exists() do not overwrite the file
seconds -
Returns:
the resulting moved file list or null

asynchFileCopyToNFS

public static FutureTask<File> asynchFileCopyToNFS(ExecutorService ex,
                                                   File source,
                                                   File destination,
                                                   int seconds)
                                            throws RejectedExecutionException,
                                                   IllegalArgumentException
Parameters:
ex -
source -
destination -
seconds -
Returns:
Throws:
RejectedExecutionException - - if this task cannot be accepted for execution.
IllegalArgumentException - - if executor is null or terminated.

asynchCopyListFileToNFS

public static List<FutureTask<File>> asynchCopyListFileToNFS(ExecutorService ex,
                                                             List<File> list,
                                                             File baseDestDir,
                                                             int seconds)
Copy a list of files asynchronously to a destination (which can be on nfs) each thread wait (at least) 'seconds' seconds for each file propagation.

Parameters:
ex - the thread pool executor
baseDestDir -
overwrite - if false and destination exists() do not overwrite the file
seconds -
Returns:
the resulting moved file list or null


Copyright © 2011-2012 GeoSolutions. All Rights Reserved.