Public Member Functions | |
LinkChecker (String document) | |
boolean | checkLinkRules (String fName, int line) |
void | doCheck () throws IOException |
void | error (String err, int line) |
void | hrefReference (String target, int line) |
void | imageReference (String imageFileName, int line) |
Static Public Member Functions | |
static boolean | fileAbsolute (String path) |
static String | fileMinusPath (String f) |
static String | fileMinusPathLocal (String f) |
static boolean | fileProtocolURL (String target) |
static String | getParent (String path) |
static boolean | imageLinkIsOk (String file) throws IOException |
static String | offensivePathMember (String fName) |
static String | pathMinusFile (String f) |
static void | visit (String file) throws IOException |
static boolean | visited (String file) throws IOException |
static void | visitImage (String file) throws IOException |
LinkChecker.LinkChecker | ( | String | document | ) |
References pathMinusFile().
Referenced by hrefReference().
boolean LinkChecker.checkLinkRules | ( | String | fName, | |
int | line | |||
) |
References error(), fileMinusPathLocal(), and offensivePathMember().
Referenced by hrefReference(), and imageReference().
void LinkChecker.doCheck | ( | ) | throws IOException |
References error(), and visit().
Referenced by hrefReference(), and Main.main().
void LinkChecker.error | ( | String | err, | |
int | line | |||
) |
Referenced by checkLinkRules(), doCheck(), hrefReference(), and imageReference().
static boolean LinkChecker.fileAbsolute | ( | String | path | ) | [static] |
Referenced by getParent().
static String LinkChecker.fileMinusPath | ( | String | f | ) | [static] |
Return file from end of HTML path; i.e., use '/' separator
Referenced by offensivePathMember().
static String LinkChecker.fileMinusPathLocal | ( | String | f | ) | [static] |
Return file from end of locally correct path; i.e., use '/' or '\' separator
Referenced by checkLinkRules().
static boolean LinkChecker.fileProtocolURL | ( | String | target | ) | [static] |
Referenced by hrefReference().
static String LinkChecker.getParent | ( | String | path | ) | [static] |
References fileAbsolute().
Referenced by offensivePathMember().
void LinkChecker.hrefReference | ( | String | target, | |
int | line | |||
) |
Implements LinkListener.
References checkLinkRules(), doCheck(), error(), fileProtocolURL(), and LinkChecker().
static boolean LinkChecker.imageLinkIsOk | ( | String | file | ) | throws IOException [static] |
Referenced by imageReference().
void LinkChecker.imageReference | ( | String | imageFileName, | |
int | line | |||
) |
Implements LinkListener.
References checkLinkRules(), error(), imageLinkIsOk(), and visitImage().
static String LinkChecker.offensivePathMember | ( | String | fName | ) | [static] |
Given a path to a file or dir, is the case of the reference the same as the actual path on the disk? This is only meaningful on a PC which is case-insensitive (not a real file system).
Returns null if there is nothing offensive and the file exists. Returns offending file/dir if it does not exist or it has there is a case mismatch for it. The last file is checked first followed by the parent directory, recursively, all the way to the absolute or relative path root in that String; i.e., we parse from right to left.
Because the File object won't actually go get the real filename from the disk so we can compare, we must get a directory listing of the directory and then look for the referenced file or dir. For example, for "./images/logo.gif" we would check "./images" dir listing for "logo.gif" with the appropriate case and then check directory "." for a dir called images with the right case. When no parent exists, we can stop looking for case problems.
References fileMinusPath(), and getParent().
Referenced by checkLinkRules().
static String LinkChecker.pathMinusFile | ( | String | f | ) | [static] |
Referenced by LinkChecker().
static void LinkChecker.visit | ( | String | file | ) | throws IOException [static] |
Referenced by doCheck().
static boolean LinkChecker.visited | ( | String | file | ) | throws IOException [static] |
static void LinkChecker.visitImage | ( | String | file | ) | throws IOException [static] |
Referenced by imageReference().