com.glaivestone.javax.io
Class FileSystemReference

java.lang.Object
  |
  +--com.glaivestone.javax.io.FileSystemReference

public class FileSystemReference
extends java.lang.Object

Services for working with references to files and directories in a file system.

Editoral Remarks

The underlying Java base class library file system support does not support objects which distinguish between file and directory elements. Consequently, prototocol for both types of elements are muddled together in the File, class which makes it somewhat confusing and hard to work with.

Be aware that a File instance holds a file system path reference which need not reference an existing element. There is no distinction between a path reference and the referenced element, which again can make the base system classes somewhat hard to work with.

Implementation Notes

At some point this class will likely become instantiatable and provide name parsing and resolution services along the lines of the Visual Smalltalk FileSystemPath class.
[Deb 23-Jan-2002]

Author:
Deb Lewis

Method Summary
static java.lang.String computeRelativePath(java.io.File fsElement, java.io.File referenceDirectory)
          Answer the relative path name of the specified file system element relative to a reference directory in the file system hierarchy.
static java.lang.String getFileBaseName(java.io.File aFile)
          Answer the base file name (without extension) of the given file.
static java.lang.String getFileBaseName(java.lang.String aFileName)
          Answer the base file name (without extension) of the given file name.
static java.lang.String getFileExtension(java.io.File aFile)
          Answer the file extension of the given file.
static java.lang.String getFileExtension(java.lang.String aFileName)
          Answer the file extension of the given file name.
static boolean hasFileExtension(java.io.File aFile, java.lang.String extension)
          Answer whether the given file has the specified extensions.
static java.lang.String mapPathSeparator(java.lang.String aPathName, char separator)
          Map the path component separator in a local file system path name to use the specified separator.
static java.io.File resolveRelativePath(java.io.File referenceDirectory, java.lang.String relativePathName)
          Resolve a relative file system path name.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

computeRelativePath

public static java.lang.String computeRelativePath(java.io.File fsElement,
                                                   java.io.File referenceDirectory)
Answer the relative path name of the specified file system element relative to a reference directory in the file system hierarchy. Returns null if there is not relative path to reach the element because it is not contained within the given directory,


getFileBaseName

public static java.lang.String getFileBaseName(java.io.File aFile)
Answer the base file name (without extension) of the given file.


getFileBaseName

public static java.lang.String getFileBaseName(java.lang.String aFileName)
Answer the base file name (without extension) of the given file name.


getFileExtension

public static java.lang.String getFileExtension(java.io.File aFile)
Answer the file extension of the given file. Returns null if the file name does not have an extension.


getFileExtension

public static java.lang.String getFileExtension(java.lang.String aFileName)
Answer the file extension of the given file name. Returns null if the file name does not have an extension.


hasFileExtension

public static boolean hasFileExtension(java.io.File aFile,
                                       java.lang.String extension)
Answer whether the given file has the specified extensions.


mapPathSeparator

public static java.lang.String mapPathSeparator(java.lang.String aPathName,
                                                char separator)
Map the path component separator in a local file system path name to use the specified separator.


resolveRelativePath

public static java.io.File resolveRelativePath(java.io.File referenceDirectory,
                                               java.lang.String relativePathName)
Resolve a relative file system path name.


GFL 1.1 API