org.edg.data.util
Class FileUtil

java.lang.Object
  |
  +--org.edg.data.util.FileUtil

public class FileUtil
extends java.lang.Object

File utilities

Version:
$Id: FileUtil.java,v 1.5 2003/10/15 10:01:14 jamesc Exp $
Author:
Peter Kunszt

Constructor Summary
FileUtil()
           
 
Method Summary
static java.lang.String assemblePath(java.lang.String path1, java.lang.String path2)
          This method assembles two paths, putting exactly one '/' between them, irrespective of whether the first ends with one, the second starts with one or not.
static java.lang.String getParentDirectory(java.lang.String pathname)
          Method getDirectory() will retrieve the parent directory of the filename.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileUtil

public FileUtil()
Method Detail

assemblePath

public static java.lang.String assemblePath(java.lang.String path1,
                                            java.lang.String path2)
This method assembles two paths, putting exactly one '/' between them, irrespective of whether the first ends with one, the second starts with one or not.

Parameters:
path1 - If this is null, the second path will get a leading '/' if there is none yet
path2 - If this is null, path1 is returned as is.
Returns:
the path

getParentDirectory

public static java.lang.String getParentDirectory(java.lang.String pathname)
Method getDirectory() will retrieve the parent directory of the filename. For example 1) hostname/simple/sample/trivial.txt 2) hostname/simple/sample/ In case 1) the String returned is: hostname/simple/sample/ In case 2) the String returned is: hostname/simple/

Parameters:
pathname - a file path.
Returns:
String the parent directory, obtained from the supplied sfn.