Step 5a: Refined Design, class URLCharacter |
previous contents next |
URL must be public. InvalidURLExceptions
thrown by the parser should also be public to inform the user about
parsing failures. The remaining classes URLCharacter and Parser
will be made package private to hide the parser details from the user:
de.extremejava.url packge first.
The necessary methods of the class URLCharacter are defined by the
character classes in the RFC grammar. We will name the methods according
to the pattern is<character class>(). Most methods will
get a single character as argument. However, escaped characters are a
special case because they consist of a '%' and two hex digits. For methods
which check for escaped characters, the argument will be a string. Since
URLCharacter contains only helper methods, we will make the
default constructor protected and all other methods
static public.
The fastest way to implement the initial method versions will be to copy and
paste Java oneliners in the source code of the URLCharacter
class like this:
| previous contents next |
© 2001 A. Heilwagen