Packages
 In this topic

*Methods

 

Packages   PreviousThis PackageNext
Package com.ms.io   Previous This
Package
Next

 


Class Path

public class Path
{
  // Methods
  public static String append(String stPath1, String stPath2);
  public static String getExtension(String stPath);
  public static boolean hasExecExtensionType(String stPath);
  public static boolean isRoot(String stPath);
  public static boolean isValidFileChar (char ch);
  public static String removeBeginEndQuotes(String stPath);
  public static String removeTrailingSlash(String stPath);
  public static String validateFilename (String origfilename,
        char replch) throws IOException;
}

This class provides methods for checking and manipulating strings that represent paths.

Methods

append

public static String append(String stPath1, String stPath2);

Appends one path string to another. If necessary, a separator is inserted between the path strings.

Return Value:

Returns the string that consists of the second path appended to the first.

ParameterDescription
stPath1 The first path.
stPath2 The second path, which will be appended to the first path.

getExtension

public static String getExtension(String stPath);

Retrieves the extension of the filename. If there is no extension, this method returns null.

Return Value:

Returns the extension of the filename.

ParameterDescription
stPath The path string.

hasExecExtensionType

public static boolean hasExecExtensionType(String stPath);

Determines whether the path string ends in .exe, .com, .bat, .pif, or .cmd.

Return Value:

Returns true if the path string ends in .exe, .com, .bat, .pif, or .cmd; otherwise, returns false.

ParameterDescription
stPath The path string.

isRoot

public static boolean isRoot(String stPath);

Determines whether the path string is a root path. For example, the following strings are root paths: "\", "c:\", "\\server\", and "\\server\share".

Return Value:

Returns true if the path string is a root path; otherwise, returns false.

ParameterDescription
stPath The path string.

isValidFileChar

public static boolean isValidFileChar (char ch);

Determines whether a character can be used in a filename.

Return Value:

Returns true if the character can be used in a filename; otherwise, returns false.

ParameterDescription
ch The character that is checked to see if it is valid in a filename.

removeBeginEndQuotes

public static String removeBeginEndQuotes(String stPath);

Removes leading and trailing quotes from the path string, if there are any.

Return Value:

Returns the path string with quotes removed.

ParameterDescription
stPath The path string to remove quotes from.

removeTrailingSlash

public static String removeTrailingSlash(String stPath);

Removes a trailing backslash unless the path is a root path.

Return Value:

Returns the path string without the trailing backslash. If the path is a root path, it remains unchanged.

ParameterDescription
stPath The path string.

validateFilename

public static String validateFilename (String origfilename,
        char replch) throws IOException;

Checks a filename, and if it is not valid, attempts to correct it.

Return Value:

Returns a valid filename or the original filename, if it is already valid.

ParameterDescription
origfilename The filename to check and correct.
replch The character to replace invalid characters with.

Exceptions:

IOException if the filename cannot be corrected.

upnrm.gif © 1998 Microsoft Corporation. All rights reserved. Terms of use.