Microsoft SDK for Java

File.getRoot

Retrieves the root portion of the specified path.

Syntax

public static String getRoot( String path )

Parameters

path

The path of a file or directory.

Return Value

Returns the root portion of the specified path.

Remarks

The resulting string consists of the rightmost characters that make up the root of the path. Possible patterns for the resulting string are:

An empty string (a relative path on the current drive).

\     An absolute path on the current drive.

x:    A relative path on a specified drive, where x is the drive letter.

x:\ An absolute path on a specified drive.

\\server\share    A universal naming convention (UNC) path for a specific server and share name.

The resulting string is null if path is null.

See Also   getDirectory, getExtension, getName, isRooted

© 1999 Microsoft Corporation. All rights reserved. Terms of use.