JEphem site
jephem API
Build classes

tig
Class Files

java.lang.Object
  |
  +--tig.Files
All Implemented Interfaces:
GeneralConstants

public class Files
extends java.lang.Object
implements GeneralConstants

Contains miscelaneous utility methods dealing with files and directories.


Field Summary
 
Fields inherited from interface tig.GeneralConstants
BLANK, FS, LS, NO_SPECIF, SPACE
 
Constructor Summary
Files()
           
 
Method Summary
static void dirToTree(java.io.File theDir, javax.swing.tree.DefaultMutableTreeNode rootNode)
          Converts a file hierarchy into a tree.
static void dirToTree(java.io.File theDir, javax.swing.tree.DefaultMutableTreeNode rootNode, java.lang.String fileType)
          Converts a file hierarchy into a tree ; only files of a given type are put in the output tree.
static void fileCopy(java.lang.String source, java.lang.String dest)
          Copies file identified by 'source' to 'dest'.
static java.lang.String getExtension(java.io.File f)
          Returns the extension of a string (characters located after the last point).
static java.lang.String getExtension(java.lang.String s)
          Returns the extension of a string (characters located after the last point).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Files

public Files()
Method Detail

getExtension

public static java.lang.String getExtension(java.io.File f)
Returns the extension of a string (characters located after the last point).

Returns:
Extension of the String 's'.

getExtension

public static java.lang.String getExtension(java.lang.String s)
Returns the extension of a string (characters located after the last point).

Parameters:
s - String from which we want to find the extension.
Returns:
Extension of the String 's'.

dirToTree

public static void dirToTree(java.io.File theDir,
                             javax.swing.tree.DefaultMutableTreeNode rootNode)
Converts a file hierarchy into a tree.
If 'theDir' is not a directory, 'rootNode' remains unchanged.
Each node of the tree contains the absolute path of the file it represents as UserObject.
All files contained in the directory are added to the tree, whatever their type..

Parameters:
theDir - Directory to transform into a tree.
rootNode - Root node of the resulting tree.

dirToTree

public static void dirToTree(java.io.File theDir,
                             javax.swing.tree.DefaultMutableTreeNode rootNode,
                             java.lang.String fileType)
Converts a file hierarchy into a tree ; only files of a given type are put in the output tree.

Parameters:
theDir - Directory to transform into a tree.
rootNode - Root node of the resulting tree.
fileType - String used to specify which type of file should be included in the output tree.

fileCopy

public static void fileCopy(java.lang.String source,
                            java.lang.String dest)
                     throws java.io.IOException
Copies file identified by 'source' to 'dest'.
Works with absolute or relative path names.

Parameters:
source - path of the source file.
dest - path of the destination file.
Throws:
java.io.IOException - if :
  • 'source' does not exist ;
  • 'dest' corresponds to a directory ;
  • other I/O problem occurs.

  • JEphem site
    jephem API
    Build classes