Class FileFetchUtil
java.lang.Object
com.norconex.crawler.fs.fetch.impl.FileFetchUtil
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanreferenceStartsWith(FetchRequest req, String... prefixes) Whether a reference starts with any of the given prefixes (typically URI schemes).static StringuriEncodeLocalPath(String path) Ensures paths to local files can be converted to valid URIs by properly encoding each path segments.
-
Method Details
-
referenceStartsWith
Whether a reference starts with any of the given prefixes (typically URI schemes).- Parameters:
req- file fetch requestprefixes- prefixes to compare- Returns:
trueif the request reference starts with one of the supplied prefixes
-
uriEncodeLocalPath
Ensures paths to local files can be converted to valid URIs by properly encoding each path segments. Non local files are returned unchanged.
We consider a path to be a local file path (absolute or relative) if it matches any of these conditions: - no scheme - scheme is "file" - scheme is one letter (e.g., windows drive letter)
- Parameters:
path- the path to encode- Returns:
- encode encoded path
-