public class FileRetrieveImpl extends Object implements FileRetrieve
Constructor and Description |
---|
FileRetrieveImpl() |
FileRetrieveImpl(File rootdir)
Constructs a new FileRetrieveImpl with the given root url's and directories
|
FileRetrieveImpl(String... strings)
Constructs a new FileRetrieveImpl with the given root url's and directories
|
Modifier and Type | Method and Description |
---|---|
void |
addRootDir(File dir)
Add a root directory.
|
void |
addURL(String url)
Add a root URL.
|
void |
processFromHref(String href, ReadingProcessor processor)
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.
|
void |
processFromStream(InputStream in, ReadingProcessor processor)
Process content from a given stream.
|
public FileRetrieveImpl()
public FileRetrieveImpl(String... strings)
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()
public FileRetrieveImpl(File rootdir)
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()
public void processFromHref(String href, ReadingProcessor processor) throws IOException
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.
href
is a valid file and can read it.
href
as file path until a valid file has been found.
processFromHref
in interface FileRetrieve
href
- the URL to process
processor
- the ReadingProcessor
IOException
- if something went wrong.
public void processFromStream(InputStream in, ReadingProcessor processor) throws IOException
FileRetrieve
processFromStream
in interface FileRetrieve
in
- the stream to process
processor
- the ReadingProcessor
IOException
- if something went wrong.
public void addRootDir(File dir)
dir
- the root directory
public void addURL(String url)
url
- the URL
Copyright © 2016. All rights reserved.