rebuild.util.io
Class Path

java.lang.Object
  extended by rebuild.util.io.Path

public final class Path
extends java.lang.Object

Various path related functions for the Blackberry.

Since:
BBX 1.0.1

Field Summary
static char DirectorySeparatorChar
          Provides a platform-specific character used to separate directory levels in a path string that reflects a hierarchical file system organization.
static java.lang.String DirectorySeparatorString
          Provides a platform-specific string used to separate directory levels in a path string that reflects a hierarchical file system organization.
static java.lang.Class FILE_TYPE
          The file connection type.
static java.lang.String NewLine
          Gets the newline string defined for this environment.
static int PATH_FOLDER_ICONS
          Get the path to the folder icons.
static int PATH_FOLDER_ICONS_BB
          Get the path to the folder icons.
static int PATH_FOLDER_ICONS_SIM
          Get the path to the folder icons.
static int PATH_FOLDER_REMOVABLE_MEMORY
          The root or the removable memory on the Blackberry.
static int PATH_FOLDER_SYSTEM
          The root flash memory for the Blackberry.
static char VolumeSeparatorChar
          Provides a platform-specific volume separator character.
 
Method Summary
static java.lang.String GetDirectoryName(java.lang.String path)
          Returns the directory information for the specified path string.
static java.lang.String GetExtension(java.lang.String path)
          Returns the extension of the specified path string.
static java.lang.String GetFileName(java.lang.String path)
          Returns the file name and extension of the specified path string.
static java.lang.String GetFileNameWithoutExtension(java.lang.String path)
          Returns the file name of the specified path string without the extension.
static java.lang.String GetRandomFileName()
          Returns a random folder name or file name.
static java.lang.String getSystemPath(int type)
          Get a standard system path.
static boolean IsPathRooted(java.lang.String path)
          Gets a value indicating whether the specified path string contains absolute or relative path information.
static boolean IsProperType(java.lang.String path, java.lang.Class c)
          Compares the path submitted and the desired type to determine if they are the same.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PATH_FOLDER_ICONS

public static final int PATH_FOLDER_ICONS
Get the path to the folder icons. Type is automatically determined.

See Also:
Constant Field Values

PATH_FOLDER_ICONS_BB

public static final int PATH_FOLDER_ICONS_BB
Get the path to the folder icons. Path for Blackberry device only.

See Also:
Constant Field Values

PATH_FOLDER_ICONS_SIM

public static final int PATH_FOLDER_ICONS_SIM
Get the path to the folder icons. Path for Blackberry simulator only.

See Also:
Constant Field Values

PATH_FOLDER_SYSTEM

public static final int PATH_FOLDER_SYSTEM
The root flash memory for the Blackberry.

See Also:
Constant Field Values

PATH_FOLDER_REMOVABLE_MEMORY

public static final int PATH_FOLDER_REMOVABLE_MEMORY
The root or the removable memory on the Blackberry.

See Also:
Constant Field Values

DirectorySeparatorChar

public static char DirectorySeparatorChar
Provides a platform-specific character used to separate directory levels in a path string that reflects a hierarchical file system organization.


DirectorySeparatorString

public static java.lang.String DirectorySeparatorString
Provides a platform-specific string used to separate directory levels in a path string that reflects a hierarchical file system organization.


NewLine

public static java.lang.String NewLine
Gets the newline string defined for this environment.


VolumeSeparatorChar

public static char VolumeSeparatorChar
Provides a platform-specific volume separator character.


FILE_TYPE

public static java.lang.Class FILE_TYPE
The file connection type.

Method Detail

getSystemPath

public static java.lang.String getSystemPath(int type)
Get a standard system path.

Parameters:
type - Which type of folder to get, one of the PATH_FOLDER_* fields.
Returns:
The system path or null if an invalid type was inputed.

GetDirectoryName

public static java.lang.String GetDirectoryName(java.lang.String path)
Returns the directory information for the specified path string.

Parameters:
path - The path of a file or directory.
Returns:
A String containing directory information for path, or null if an error occurs.

GetExtension

public static java.lang.String GetExtension(java.lang.String path)
Returns the extension of the specified path string.

Parameters:
path - The path string from which to get the extension.
Returns:
A String containing the extension of the specified path (including the "."), null, or Empty. If path is null, GetExtension returns null. If path does not have extension information, GetExtension returns "".

GetFileName

public static java.lang.String GetFileName(java.lang.String path)
Returns the file name and extension of the specified path string.

Parameters:
path - The path string from which to obtain the file name and extension.
Returns:
A String consisting of the characters after the last directory character in path.

GetFileNameWithoutExtension

public static java.lang.String GetFileNameWithoutExtension(java.lang.String path)
Returns the file name of the specified path string without the extension.

Parameters:
path - The path of the file.
Returns:
A String containing the string returned by GetFileName, minus the last period (.) and all characters following it.

IsPathRooted

public static boolean IsPathRooted(java.lang.String path)
Gets a value indicating whether the specified path string contains absolute or relative path information.

Parameters:
path - The path to test.
Returns:
true if path contains an absolute path; otherwise, false.

IsProperType

public static boolean IsProperType(java.lang.String path,
                                   java.lang.Class c)
Compares the path submitted and the desired type to determine if they are the same.

Parameters:
path - The path to check.
c - The desired type.
Returns:
True if the path and type are the same, false if the path and type are not the same or path is null or c is null.

GetRandomFileName

public static java.lang.String GetRandomFileName()
Returns a random folder name or file name.

Returns:
A random folder name or file name.