Class FileRetrieveImpl

    • Constructor Detail

      • FileRetrieveImpl

        public FileRetrieveImpl()
      • FileRetrieveImpl

        public FileRetrieveImpl​(String... strings)
        Constructs a new FileRetrieveImpl with the given root url's and directories
        Parameters:
        strings - an array of strings, if the String starts with http or https it's taken as URL otherwise we check if it's a directory with
         File f = new File(str);
         f.isDirectory()
         
      • FileRetrieveImpl

        public FileRetrieveImpl​(File rootdir)
        Constructs a new FileRetrieveImpl with the given root url's and directories
        Parameters:
        strings - an array of strings, if the String starts with http or https it's taken as URL otherwise we check if it's a directory with
         File f = new File(str);
         f.isDirectory()
         
    • Method Detail

      • processFromHref

        public void processFromHref​(String href,
                                    ReadingProcessor processor)
                             throws IOException
        ProcessFromHref first tries to create an URL from the given href, if that throws a MalformedURLException, it will prepend the given root URLs to href until a valid URL is found.
        If by then there is no valid url found, this method will see if the given href is a valid file and can read it.
        If it's not a valid file or a file that can't be read, the given root directories will be set as root path with the given href as file path until a valid file has been found.
        Specified by:
        processFromHref in interface FileRetrieve
        Parameters:
        href - the URL to process
        processor - the ReadingProcessor
        Throws:
        IOException - if something went wrong.
      • addRootDir

        public void addRootDir​(File dir)
        Add a root directory.
        Parameters:
        dir - the root directory
      • addURL

        public void addURL​(String url)
        Add a root URL.
        Parameters:
        url - the URL