[an error occurred while processing this directive]
~gshute/public/file.jar
.
In this jar file, you will also find a skeleton file for the
HierarchicalFileSystem class.
You will implement the methods in this class to construct a hierachical
file system that uses path names like the UNIX operating system.
getTail()
and getLastDirectory()
.
These methods break up an absolute path name into two parts: everything up
to the last slash character in the path (which determines the last
directory) and everything after the last slash (the tail).
These methods can be used to simplify the implentation of the other
methods.
The getLastDirectory()
method is not trivial.
You can save yourself a lot of time by giving it some careful thought
before writing code.
One approach is to think of an absolute path as a sequence of names
separated by directory separator characters (slashes).
From this viewpoint, the first name in an absolute path is always an empty
string.
The class is set up with a main()
method that you can use for
initial testing.
If you look over this code, you can find some examples showing how the
underlying flat file system is accessed.
After you have implemented the two private methods, you will need to
implement the public methods.
Then you can use the TestHFS class to make sure the public methods all
work properly.