visad.install
Class Util

java.lang.Object
  extended by visad.install.Util

public class Util
extends Object


Constructor Summary
Util()
           
 
Method Summary
static boolean copyDirectory(File source, File target)
           
static boolean copyDirectory(File source, File target, String saveSuffix)
           
static boolean copyDirectory(ProgressMonitor progress, File source, File target)
           
static boolean copyDirectory(ProgressMonitor progress, File source, File target, String saveSuffix)
          Copy files under the source directory to the target directory.
static boolean copyFile(File source, File target)
           
static boolean copyFile(File source, File target, String saveSuffix)
           
static boolean copyFile(ProgressMonitor progress, File source, File target)
           
static boolean copyFile(ProgressMonitor progress, File source, File target, String saveSuffix)
          Copy the source file to target.
static boolean copyJar(File source, File target)
           
static boolean copyJar(File source, File target, String saveSuffix)
           
static boolean copyJar(ProgressMonitor progress, File source, File target)
           
static boolean copyJar(ProgressMonitor progress, File source, File target, String saveSuffix)
          Extract files from the source jar file to the target directory.
static String getPath(File f)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Util

public Util()
Method Detail

copyDirectory

public static final boolean copyDirectory(File source,
                                          File target)
See Also:
copyDirectory(ProgressMonitor, File, File, String)

copyDirectory

public static final boolean copyDirectory(ProgressMonitor progress,
                                          File source,
                                          File target)
See Also:
copyDirectory(ProgressMonitor, File, File, String)

copyDirectory

public static final boolean copyDirectory(File source,
                                          File target,
                                          String saveSuffix)
See Also:
copyDirectory(ProgressMonitor, File, File, String)

copyDirectory

public static final boolean copyDirectory(ProgressMonitor progress,
                                          File source,
                                          File target,
                                          String saveSuffix)
Copy files under the source directory to the target directory. If necessary, target directory is created.

For example, if this method is called with a source of /foo (which contains /foo/a and /foo/b) and a target of /bar, when this method exits /bar will contain /bar/a and /bar/b. Note that foo itself is not copied.

Parameters:
progress - if non-null, this progress monitor is updated with the name of each file as it is copied.
source - source directory
target - directory
saveSuffix - if non-null, pre-existing files under target whose paths match files to be copied from source will be renamed to name + saveSuffix.
Returns:
false if any problems were encountered.

copyFile

public static final boolean copyFile(File source,
                                     File target)
See Also:
copyFile(ProgressMonitor, File, File, String)

copyFile

public static final boolean copyFile(ProgressMonitor progress,
                                     File source,
                                     File target)
See Also:
copyFile(ProgressMonitor, File, File, String)

copyFile

public static final boolean copyFile(File source,
                                     File target,
                                     String saveSuffix)
See Also:
copyFile(ProgressMonitor, File, File, String)

copyFile

public static final boolean copyFile(ProgressMonitor progress,
                                     File source,
                                     File target,
                                     String saveSuffix)
Copy the source file to target. If target does not exist, it is assumed to be the name of the copied file. If target is a directory, the file will be copied into that directory.

Parameters:
progress - if non-null, this progress monitor is updated with the name of each file as it is copied.
source - source directory
target - target file/directory
saveSuffix - if non-null and target exists, target will be renamed to name + saveSuffix.
Returns:
false if any problems were encountered.

copyJar

public static final boolean copyJar(File source,
                                    File target)
See Also:
copyJar(ProgressMonitor, File, File, String)

copyJar

public static final boolean copyJar(ProgressMonitor progress,
                                    File source,
                                    File target)
See Also:
copyJar(ProgressMonitor, File, File, String)

copyJar

public static final boolean copyJar(File source,
                                    File target,
                                    String saveSuffix)
See Also:
copyJar(ProgressMonitor, File, File, String)

copyJar

public static final boolean copyJar(ProgressMonitor progress,
                                    File source,
                                    File target,
                                    String saveSuffix)
Extract files from the source jar file to the target directory. If necessary, the target directory is created.

For example, if this method is called with a source of foo.jar (which contains a and b) and a target of /bar, when this method exits /bar will contain /bar/a and /bar/b.

Parameters:
progress - if non-null, this progress monitor is updated with the name of each file as it is copied.
source - source jar file
target - directory
saveSuffix - if non-null, pre-existing files in target whose paths match files to be copied from source will be renamed to name + saveSuffix.
Returns:
false if any problems were encountered.

getPath

public static final String getPath(File f)
Returns:
either the canonical path or, if that is not available, the absolute path.