Package com.itextpdf.tool.xml.net
Class FileRetrieveImpl
- java.lang.Object
-
- com.itextpdf.tool.xml.net.FileRetrieveImpl
-
- All Implemented Interfaces:
FileRetrieve
public class FileRetrieveImpl extends java.lang.Object implements FileRetrieve
- Author:
- redlab_b
-
-
Constructor Summary
Constructors Constructor Description FileRetrieveImpl()FileRetrieveImpl(java.io.File rootdir)Constructs a new FileRetrieveImpl with the given root url's and directoriesFileRetrieveImpl(java.lang.String... strings)Constructs a new FileRetrieveImpl with the given root url's and directories
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddRootDir(java.io.File dir)Add a root directory.voidaddURL(java.lang.String url)Add a root URL.voidprocessFromHref(java.lang.String href, ReadingProcessor processor)ProcessFromHref first tries to create anURLfrom the givenhref, if that throws aMalformedURLException, it will prepend the given root URLs tohrefuntil a valid URL is found.
If by then there is no valid url found, this method will see if the givenhrefis 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 givenhrefas file path until a valid file has been found.voidprocessFromStream(java.io.InputStream in, ReadingProcessor processor)Process content from a given stream.
-
-
-
Constructor Detail
-
FileRetrieveImpl
public FileRetrieveImpl()
-
FileRetrieveImpl
public FileRetrieveImpl(java.lang.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 withFile f = new File(str); f.isDirectory()
-
FileRetrieveImpl
public FileRetrieveImpl(java.io.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 withFile f = new File(str); f.isDirectory()
-
-
Method Detail
-
processFromHref
public void processFromHref(java.lang.String href, ReadingProcessor processor) throws java.io.IOExceptionProcessFromHref first tries to create anURLfrom the givenhref, if that throws aMalformedURLException, it will prepend the given root URLs tohrefuntil a valid URL is found.
If by then there is no valid url found, this method will see if the givenhrefis 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 givenhrefas file path until a valid file has been found.- Specified by:
processFromHrefin interfaceFileRetrieve- Parameters:
href- the URL to processprocessor- the ReadingProcessor- Throws:
java.io.IOException- if something went wrong.
-
processFromStream
public void processFromStream(java.io.InputStream in, ReadingProcessor processor) throws java.io.IOExceptionDescription copied from interface:FileRetrieveProcess content from a given stream.- Specified by:
processFromStreamin interfaceFileRetrieve- Parameters:
in- the stream to processprocessor- the ReadingProcessor- Throws:
java.io.IOException- if something went wrong.
-
addRootDir
public void addRootDir(java.io.File dir)
Add a root directory.- Parameters:
dir- the root directory
-
addURL
public void addURL(java.lang.String url)
Add a root URL.- Parameters:
url- the URL
-
-