org.eclipse.jgit.util
Class FS

java.lang.Object
  extended by org.eclipse.jgit.util.FS

public abstract class FS
extends java.lang.Object

Abstraction to support various file system operations not in Java.


Field Summary
static FS INSTANCE
          The implementation selected for this operating system and JRE.
 
Constructor Summary
FS()
           
 
Method Summary
abstract  boolean canExecute(java.io.File f)
          Determine if the file is executable (or not).
static java.io.File resolve(java.io.File dir, java.lang.String name)
          Resolve this file to its actual path name that the JRE can use.
protected  java.io.File resolveImpl(java.io.File dir, java.lang.String name)
          Resolve this file to its actual path name that the JRE can use.
abstract  boolean setExecute(java.io.File f, boolean canExec)
          Set a file to be executable by the user.
abstract  boolean supportsExecute()
          Does this operating system and JRE support the execute flag on files?
static java.io.File userHome()
          Determine the user's home directory (location where preferences are).
protected  java.io.File userHomeImpl()
          Determine the user's home directory (location where preferences are).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

public static final FS INSTANCE
The implementation selected for this operating system and JRE.

Constructor Detail

FS

public FS()
Method Detail

supportsExecute

public abstract boolean supportsExecute()
Does this operating system and JRE support the execute flag on files?

Returns:
true if this implementation can provide reasonably accurate executable bit information; false otherwise.

canExecute

public abstract boolean canExecute(java.io.File f)
Determine if the file is executable (or not).

Not all platforms and JREs support executable flags on files. If the feature is unsupported this method will always return false.

Parameters:
f - abstract path to test.
Returns:
true if the file is believed to be executable by the user.

setExecute

public abstract boolean setExecute(java.io.File f,
                                   boolean canExec)
Set a file to be executable by the user.

Not all platforms and JREs support executable flags on files. If the feature is unsupported this method will always return false and no changes will be made to the file specified.

Parameters:
f - path to modify the executable status of.
canExec - true to enable execution; false to disable it.
Returns:
true if the change succeeded; false otherwise.

resolve

public static java.io.File resolve(java.io.File dir,
                                   java.lang.String name)
Resolve this file to its actual path name that the JRE can use.

This method can be relatively expensive. Computing a translation may require forking an external process per path name translated. Callers should try to minimize the number of translations necessary by caching the results.

Not all platforms and JREs require path name translation. Currently only Cygwin on Win32 require translation for Cygwin based paths.

Parameters:
dir - directory relative to which the path name is.
name - path name to translate.
Returns:
the translated path. new File(dir,name) if this platform does not require path name translation.

resolveImpl

protected java.io.File resolveImpl(java.io.File dir,
                                   java.lang.String name)
Resolve this file to its actual path name that the JRE can use.

This method can be relatively expensive. Computing a translation may require forking an external process per path name translated. Callers should try to minimize the number of translations necessary by caching the results.

Not all platforms and JREs require path name translation. Currently only Cygwin on Win32 require translation for Cygwin based paths.

Parameters:
dir - directory relative to which the path name is.
name - path name to translate.
Returns:
the translated path. new File(dir,name) if this platform does not require path name translation.

userHome

public static java.io.File userHome()
Determine the user's home directory (location where preferences are).

This method can be expensive on the first invocation if path name translation is required. Subsequent invocations return a cached result.

Not all platforms and JREs require path name translation. Currently only Cygwin on Win32 requires translation of the Cygwin HOME directory.

Returns:
the user's home directory; null if the user does not have one.

userHomeImpl

protected java.io.File userHomeImpl()
Determine the user's home directory (location where preferences are).

Returns:
the user's home directory; null if the user does not have one.