FileRetrieve
public class FileRetrieveImpl extends java.lang.Object implements FileRetrieve
Constructor | Description |
---|---|
FileRetrieveImpl() |
|
FileRetrieveImpl(java.io.File rootdir) |
Constructs a new FileRetrieveImpl with the given root url's and
directories
|
FileRetrieveImpl(java.lang.String... strings) |
Constructs a new FileRetrieveImpl with the given root url's and
directories
|
Modifier and Type | Method | Description |
---|---|---|
void |
addRootDir(java.io.File dir) |
Add a root directory.
|
void |
addURL(java.lang.String url) |
Add a root URL.
|
void |
processFromHref(java.lang.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.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. |
void |
processFromStream(java.io.InputStream in,
ReadingProcessor processor) |
Process content from a given stream.
|
public FileRetrieveImpl()
public FileRetrieveImpl(java.lang.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(java.io.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(java.lang.String href, ReadingProcessor processor) throws java.io.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 processprocessor
- the ReadingProcessorjava.io.IOException
- if something went wrong.public void processFromStream(java.io.InputStream in, ReadingProcessor processor) throws java.io.IOException
FileRetrieve
processFromStream
in interface FileRetrieve
in
- the stream to processprocessor
- the ReadingProcessorjava.io.IOException
- if something went wrong.public void addRootDir(java.io.File dir)
dir
- the root directorypublic void addURL(java.lang.String url)
url
- the URLCopyright © 1998–2018. All rights reserved.