PATH  Documentation > Mac OS X > Foundation Reference: Java



Table of Contents

NSPathUtilities


Inherits from:
NSObject
Package:
com.apple.yellow.foundation


Class Description


Description forthcoming.




Constants


The following constants are provided by NSPathUtilities:


Constant Type Description
AdminApplicationDirectory int 4
AllApplicationsDirectory int 100
AllDomainsMask int 65535
AllLibrariesDirectory int 101
ApplicationDirectory int 1
DemoApplicationDirectory int 2
DeveloperApplicationDirectory int 3
DeveloperDirectory int 6
DocumentationDirectory int 8
LibraryDirectory int 5
LocalDomainMask int 2
NetworkDomainMask int 4
SystemDomainMask int 8
UserDirectory int 7
UserDomainMask int 1



Method Types


Constructors
NSPathUtilities
TBD_Functional_Method_Group
URLWithPath
fileAttributes
isAbsolutePath
lastPathComponent
pathComponents
pathExtension
pathFromURL
pathWithComponents
pathsMatchingExtensions
searchPathForDirectoriesInDomains
setFileAttributes
stringByAbbreviatingWithTildeInPath
stringByAppendingPathComponent
stringByAppendingPathExtension
stringByDeletingLastPathComponent
stringByDeletingPathExtension
stringByExpandingTildeInPath
stringByResolvingSymlinksInPath
stringByStandardizingPath
stringsByAppendingPaths
temporaryDirectory


Constructors



NSPathUtilities

public NSPathUtilities()

Description forthcoming.


Static Methods



URLWithPath

public static java.net.URL URLWithPath(String aString)

Description forthcoming.

fileAttributes

public static NSDictionary fileAttributes( String aString, boolean aBoolean)

Description forthcoming.

isAbsolutePath

public static boolean isAbsolutePath(String aString)

Interprets aString as a path, returning true if it represents an absolute path, false if it represents a relative path.

lastPathComponent

public static String lastPathComponent(String aString)

Returns the last path component of aString. The following table illustrates the effect of lastPathComponent on a variety of different paths:
aString's Value String Returned
"/tmp/scratch.tiff" "scratch.tiff"
"/tmp/scratch" "scratch"
"/tmp/" "tmp"
"scratch" "scratch"
"/" "" (an empty string)



pathComponents

public static NSArray pathComponents(String aString)

Interprets aString as a path, returning an array of strings containing, in order, each path component of aString. The strings in the array appear in the order they did in aString. If aString begins or ends with the path separator then the first or last component, respectively, will contain the separator. Empty components (caused by consecutive path separators) are deleted.

If aString begins with a slash-for example, "/tmp/scratch"-the array has these contents:


Index Path Component
0 "/"
1 "tmp"
2 "scratch"

If aString has no separators-for example, "scratch"-the array contains aString itself, in this case "scratch".

See Also: pathWithComponents, stringByStandardizingPath



pathExtension

public static String pathExtension(String aString)

Interprets aString as a path, returning the aString's extension, if any (not including the extension divider). The following table illustrates the effect of pathExtension on a variety of different paths:
aString's Value String Returned
"/tmp/scratch.tiff" "tiff"
"/tmp/scratch" "" (an empty string)
"/tmp/" "" (an empty string)
"/tmp/scratch..tiff" "tiff"



pathFromURL

public static String pathFromURL(java.net.URL anURL)

Description forthcoming.

pathWithComponents

public static String pathWithComponents(NSArray components)

Returns a string built from the strings in components, by concatenating them with a path separator between each pair. To create an absolute path, use a slash mark "/" as the first component. To include a trailing path divider, use an empty string as the last component. This method doesn't clean up the path created; use stringByStandardizingPath to resolve empty components, references to the parent directory, and so on.

See Also: pathComponents



pathsMatchingExtensions

public static NSArray pathsMatchingExtensions( NSArray anArray1, NSArray anArray2)

Description forthcoming.

searchPathForDirectoriesInDomains

public static NSArray searchPathForDirectoriesInDomains( int anInt1, int anInt2, boolean aBoolean)

Description forthcoming.

setFileAttributes

public static boolean setFileAttributes( String aString, NSDictionary aDictionary)

Description forthcoming.

stringByAbbreviatingWithTildeInPath

public static String stringByAbbreviatingWithTildeInPath(String aString)

Returns a string representing aString as a path, with a tilde, "~", substituted for the full path to the current user's home directory, or "~user" for a user other than the current user. Returns aString unaltered if it doesn't begin with the user's home directory.

See Also: stringByExpandingTildeInPath



stringByAppendingPathComponent

public static String stringByAppendingPathComponent( String aString1, String aString2)

Returns a string made by appending aString1 with aString2, preceded by if necessary by a path separator. The following table illustrates the effect of this method on a variety of different paths, assuming that aString2 is supplied as "scratch.tiff":
aString's Value Resulting String
"/tmp" "/tmp/scratch.tiff"
"/tmp/" "/tmp/scratch.tiff"
"/" "/scratch.tiff"
"" (an empty string) "scratch.tiff"

See Also: stringsByAppendingPaths, stringByAppendingPathExtension, stringByDeletingLastPathComponent



stringByAppendingPathExtension

public static String stringByAppendingPathExtension( String aString1, String aString2)

Returns a string made by appending to aString1 an extension separator followed by aString2. The following table illustrates the effect of this method on a variety of different paths, assuming that aString2 is supplied as "tiff":
aString's Value Resulting String
"/tmp/scratch.old" "/tmp/scratch.old.tiff"
"/tmp/scratch." "/tmp/scratch..tiff"
"/tmp/" "/tmp/.tiff"
"scratch" "scratch.tiff"

See Also: stringByAppendingPathComponent, stringByDeletingPathExtension



stringByDeletingLastPathComponent

public static String stringByDeletingLastPathComponent(String aString)

Returns a string made by deleting the last path component from aString, along with any final path separator. If aString represents the root path, however, it's returned unaltered. The following table illustrates the effect of this method on a variety of different paths:
aString's Value Resulting String
"/tmp/scratch.tiff" "/tmp"
"/tmp/lock/" "/tmp"
"/tmp/" "/"
"/tmp" "/"
"/" "/"
"scratch.tiff" "" (an empty string)

See Also: stringByDeletingPathExtension, stringByAppendingPathComponent



stringByDeletingPathExtension

public static String stringByDeletingPathExtension(String aString)

Returns a string made by deleting the extension (if any, and only the last) from aString. Strips any trailing path separator before checking for an extension. If aString represents the root path, however, it's returned unaltered. The following table illustrates the effect of this method on a variety of different paths:
aString's Value Resulting String
"/tmp/scratch.tiff" "/tmp/scratch"
"/tmp/" "/tmp"
"scratch.bundle/" "scratch"
"scratch..tiff" "scratch."
".tiff" "" (an empty string)
"/" "/"

See Also: pathExtension, stringByDeletingLastPathComponent



stringByExpandingTildeInPath

public static String stringByExpandingTildeInPath(String aString)

Returns a string made by expanding the initial component of aString, if it begins with "~" or "~user", to its full path value. Returns aString unaltered if that component can't be expanded.

See Also: stringByAbbreviatingWithTildeInPath



stringByResolvingSymlinksInPath

public static String stringByResolvingSymlinksInPath(String aString)

Description forthcoming.

stringByStandardizingPath

public static String stringByStandardizingPath(String aString)

Returns a string representing aString 's path, with extraneous path components removed. If stringByStandardizingPath detects symbolic links in a path name, the stringByResolvingSymlinksInPath method is called to resolve them. If an invalid path name is provided, stringByStandardizingPath may attempt to resolve it by calling stringByResolvingSymlinksInPath, and the results are undefined. If any other kind error is encountered (such as a path component not existing), this is returned.

This method can make the following changes in the provided string:

See Also: stringByExpandingTildeInPath, stringByResolvingSymlinksInPath



stringsByAppendingPaths

public static NSArray stringsByAppendingPaths( String aString, NSArray paths)

Returns an array of strings made by separately appending each string in paths to aString, preceded if necessary by a path separator. See stringByAppendingPathComponent for an individual example.

temporaryDirectory

public static String temporaryDirectory()

Description forthcoming.


Table of Contents