com.panayotis.io
Class FileUtils

java.lang.Object
  extended by com.panayotis.io.FileUtils

public class FileUtils
extends java.lang.Object

This object is used to serch for an executable in the current $PATH.


Constructor Summary
FileUtils()
           
 
Method Summary
static java.lang.String findPathExec(java.lang.String prog)
          This method browses current path to search for a file.
static java.io.File getExec(java.lang.String path)
          Check if the specified file path is a valid file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileUtils

public FileUtils()
Method Detail

getExec

public static final java.io.File getExec(java.lang.String path)
Check if the specified file path is a valid file.

Parameters:
path - The file path to check if it is valid.
Returns:
Pointer to this file, if this file is valid. Otherwise return null.

findPathExec

public static final java.lang.String findPathExec(java.lang.String prog)
This method browses current path to search for a file. Typically this should be an executable, but it is impossible under Java to check if this file has the execution bit on. Apart from the user defined $PATH variable, common bin-directory places are searched.

Parameters:
prog - The file to check if it exists in the system $PATH
Returns:
The path of the specified program. If it is not found, the program name is returned.