Class FileFetchUtil

java.lang.Object
com.norconex.crawler.fs.fetch.impl.FileFetchUtil

public final class FileFetchUtil extends Object
  • Method Details

    • referenceStartsWith

      public static boolean referenceStartsWith(FetchRequest req, String... prefixes)
      Whether a reference starts with any of the given prefixes (typically URI schemes).
      Parameters:
      req - file fetch request
      prefixes - prefixes to compare
      Returns:
      true if the request reference starts with one of the supplied prefixes
    • uriEncodeLocalPath

      public static String uriEncodeLocalPath(String path)

      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