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.
-
-
Constructor Summary
Constructors Constructor and Description Files()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static voiddirToTree(java.io.File theDir, javax.swing.tree.DefaultMutableTreeNode rootNode)Converts a file hierarchy into a tree.static voiddirToTree(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 voidfileCopy(java.lang.String source, java.lang.String dest)Copies file identified by 'source' to 'dest'.static java.lang.StringgetExtension(java.io.File f)Returns the extension of a string (characters located after the last point).static java.lang.StringgetExtension(java.lang.String s)Returns the extension of a string (characters located after the last point).
-
-
-
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).- Parameters:
s- String from which we want to find the extension.- 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.IOExceptionCopies 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.
-
-
DMelt 3.0 © DataMelt by jWork.ORG