com.starbase.util
Class FileUtils


java.lang.Object

  |

  +--com.starbase.util.FileUtils


public final class FileUtils
extends java.lang.Object

Utility class for accessing file info.


Field Summary
static long MAX_FILE_LENGTH
          Deprecated. StarTeam versions 9.0 and later support long files sizes.
static long MAX_FILE_LENGTH_80
          Maximum supported file length in StarTeam 8.0 and earlier.
 
Method Summary
static long cmp(java.io.File f1, java.io.File f2)
           
static java.lang.String condenseFilePaths(java.lang.String parentFolderPath, java.lang.String childFolderPath, boolean caseSensitive, java.lang.String delimiter)
          Compares the two paths and returns a relative path that represents the childFolderPath relative to parentFolderPath or null if either of the paths passed in are already relative or invalid, or if childFolderPath cannot be expressed relative to parentFolderPath.
static java.lang.String condensePath(java.lang.String parentFolderPath, java.lang.String childFolderPath, boolean caseSensitive)
          Deprecated.  
static java.lang.String fullyResolvedPath(java.lang.String name, java.lang.String pathDelim)
           
static java.lang.String getAbsolutePath(java.lang.String path)
          Returns the absolute pathname of the given pathname.
static java.lang.String getCanonicalPathName(java.lang.String aPathName, boolean bCaseSensitive)
           
static int getFileLength(java.io.File f)
          Deprecated. Use getFileLengthEx, which supports file sizes greater than 2GB.
static long getFileLengthEx(java.io.File f)
          Gets the length of the given file.
static java.lang.String getName(java.lang.String path, java.lang.String pathDelim)
          Returns the name of the file represented by this pathname.
static java.lang.String getParent(java.lang.String path, java.lang.String pathDelim)
          Returns the parent part of the given pathname, or null if the name has no parent part.
static boolean isAbsolute(java.lang.String path)
          Tests if the given pathname is an absolute pathname.
static boolean isBinary(java.io.File f)
          Returns true if the file is considered to be binary.
static boolean match(java.lang.String pattern, java.lang.String file, boolean caseSensitive)
           
static boolean matchesAnyPattern(java.lang.String filename, java.lang.String[] patterns, boolean caseSensitive)
           
static boolean matchPatternList(java.lang.String filename, java.lang.String patternList, boolean caseSensitive)
           
static java.lang.String[] parsePatternList(java.lang.String patternList)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_FILE_LENGTH_80


public static final long MAX_FILE_LENGTH_80
Maximum supported file length in StarTeam 8.0 and earlier. About 2GB. Note that StarTeam versions 9.0 and later support long files sizes.

See Also:
SupportedFeatures.hasLongFileSizes(), Constant Field Values

MAX_FILE_LENGTH


public static final long MAX_FILE_LENGTH
Deprecated. StarTeam versions 9.0 and later support long files sizes.

Maximum supported file length in StarTeam 8.0 and earlier. About 2GB.

See Also:
FileUtils.MAX_FILE_LENGTH_80, SupportedFeatures.hasLongFileSizes(), Constant Field Values
Method Detail

cmp


public static long cmp(java.io.File f1,
                       java.io.File f2)
                throws java.io.IOException
java.io.IOException

isBinary


public static boolean isBinary(java.io.File f)
                        throws java.io.IOException
Returns true if the file is considered to be binary. The definition of binary is that the file has at least one null (0x0) character.

java.io.IOException

getFileLength


public static int getFileLength(java.io.File f)
                         throws java.io.IOException
Deprecated. Use getFileLengthEx, which supports file sizes greater than 2GB.

Gets the length of the given file.

Parameters:
f - A file whose length is to be determined.
Returns:
int The file length.
Throws:
java.io.IOException
See Also:
FileUtils.getFileLengthEx(java.io.File)

getFileLengthEx


public static long getFileLengthEx(java.io.File f)
                            throws java.io.IOException
Gets the length of the given file.

Parameters:
f - A file whose length is to be determined.
Returns:
long The file length.
Throws:
java.io.IOException

matchPatternList


public static boolean matchPatternList(java.lang.String filename,
                                       java.lang.String patternList,
                                       boolean caseSensitive)

matchesAnyPattern


public static boolean matchesAnyPattern(java.lang.String filename,
                                        java.lang.String[] patterns,
                                        boolean caseSensitive)

parsePatternList


public static java.lang.String[] parsePatternList(java.lang.String patternList)

match


public static boolean match(java.lang.String pattern,
                            java.lang.String file,
                            boolean caseSensitive)

fullyResolvedPath


public static final java.lang.String fullyResolvedPath(java.lang.String name,
                                                       java.lang.String pathDelim)

getCanonicalPathName


public static final java.lang.String getCanonicalPathName(java.lang.String aPathName,
                                                          boolean bCaseSensitive)

getParent


public static final java.lang.String getParent(java.lang.String path,
                                               java.lang.String pathDelim)
Returns the parent part of the given pathname, or null if the name has no parent part. The parent part is generally everything leading up to the last occurrence of the separator character, although the precise definition is system dependent. On UNIX, for example, the parent part of "/usr/lib" is "/usr", whose parent part is "/", which in turn has no parent. On Windows platforms, the parent part of "c:\java" is "c:\", which in turn has no parent.

Parameters:
path - A pathname.
pathDelim - The path delimiter.
Returns:
The parent part of the pathname, or null if the name has no parent part.
See Also:
FileUtils.getName(java.lang.String, java.lang.String)

getName


public static final java.lang.String getName(java.lang.String path,
                                             java.lang.String pathDelim)
Returns the name of the file represented by this pathname. The name is everything in the pathame after the last occurrence of the separator character.

Parameters:
path - A pathname.
pathDelim - The path delimiter.
Returns:
the name of the file (without any directory components) represented by this pathname.
See Also:
FileUtils.getParent(java.lang.String, java.lang.String)

isAbsolute


public static final boolean isAbsolute(java.lang.String path)
Tests if the given pathname is an absolute pathname. The definition of an absolute pathname is system dependent. For example, on UNIX, a pathname is absolute if its first character is the separator character. On Windows platforms, a pathname is absolute if its first character is an ASCII '\' or '/', or if it begins with a letter followed by a colon.

Parameters:
path - A pathname.
Returns:
true if the pathname indicated by the File object is an absolute pathname; false otherwise.

getAbsolutePath


public static final java.lang.String getAbsolutePath(java.lang.String path)
Returns the absolute pathname of the given pathname. If the pathname is an absolute pathname, then return the pathname. Otherwise, return a pathname that is a concatenation of the current user directory, the separator character, and the pathname of this file object.

The system property user.dir contains the current user directory.

Parameters:
path - A pathname.
Returns:
a system-dependent absolute pathname.

condensePath


public static final java.lang.String condensePath(java.lang.String parentFolderPath,
                                                  java.lang.String childFolderPath,
                                                  boolean caseSensitive)
Deprecated.  

This method should no longer be called. It now calls condenseFilePaths passing the Window's file delimiter: "\".

See Also:
FileUtils.condenseFilePaths(java.lang.String, java.lang.String, boolean, java.lang.String)

condenseFilePaths


public static final java.lang.String condenseFilePaths(java.lang.String parentFolderPath,
                                                       java.lang.String childFolderPath,
                                                       boolean caseSensitive,
                                                       java.lang.String delimiter)
Compares the two paths and returns a relative path that represents the childFolderPath relative to parentFolderPath or null if either of the paths passed in are already relative or invalid, or if childFolderPath cannot be expressed relative to parentFolderPath.

Both c: and \folderName are invalid paths for the purposes of this function. GetCanonicalPathName is called on boths paths prior to comparison. This function is essentially Windows-specific, but should work correctly with at least Unix paths.



StarTeam SDK 9.0, Build 287
Copyright © 2003-2004 Borland Software Corporation. All rights reserved.