This section covers the following:
C:\
or D:\
.
The Solaris OS supports a single root node, which is denoted by the
slash character, /
.
statusReport
file in the previous figure is
described by the following notation in the Solaris OS:
/home/sally/statusReport
statusReport
is described by the
following notation:
C:\home\sally\statusReport
/
),
and Microsoft Windows uses the backslash slash (\
).
A path is either relative or absolute.
An absolute path always contains the root element
and the complete directory list required to locate the file.
For example, /home/sally/statusReport
is an
absolute path. All of the information needed to locate the file
is contained in the path string.
A relative path needs to be combined with another path
in order to access a file.
For example, joe/foo
is a relative path.
Without more information, a program cannot reliably locate the
joe/foo
directory in the file system.
A symbolic link is a special file that serves as a reference to another file. For the most part, symbolic links are transparent to applications, and operations on symbolic links are automatically redirected to the target of the link. (The file or directory being pointed to is called the target of the link.) Exceptions are when a symbolic link is deleted, or renamed in which case the link itself is deleted, or renamed and not the target of the link.
In the following figure, logFile
appears to be a regular file to the user, but it is actually a symbolic
link to dir/logs/HomeLogFile
.
HomeLogFile
is the target of the link.
A symbolic link is usually transparent to the user. Reading or writing to a symbolic link is the same as reading or writing to any other file or directory.
The phrase resolving a link means to substitute the actual location
in the file system for the symbolic link. In the example, resolving
logFile
yields dir/logs/HomeLogFile
.
In real-world scenarios,
most file systems make liberal use of symbolic links.
Occasionally, a carelessly created symbolic link can
cause a circular reference. A circular reference occurs when the target
of a link points back to the original link.
The circular reference might be indirect:
directory a
points to
directory b
, which points to directory
c
, which contains a subdirectory pointing back to
directory a
.
Circular references can cause havoc when a program is recursively
walking a directory structure.
However, this scenario has been accounted for
and will not cause your program to loop infinitely.
The next page discusses the heart of file I/O
support in the Java programming language, the Path
class.