public class DfltFileMgr extends java.lang.Object implements IQBPFileMgr
Constructor and Description |
---|
DfltFileMgr()
Create a default file manager.
|
DfltFileMgr(java.io.File allowed_directory)
Create a file manager that restricts files to a directory.
|
Modifier and Type | Method and Description |
---|---|
java.io.InputStream |
getReaderFor(java.io.File file_id)
Get an input stream reader for a file identified by a File object.
|
java.io.InputStream |
getReaderFor(java.lang.String data_source)
Get an input stream reader for a file identified by a string value.
|
java.lang.String |
verify(java.io.File data_file)
Check if a File is a valid data source.
|
java.lang.String |
verify(java.lang.String data_source)
Check if the given data source is valid.
|
public DfltFileMgr()
public DfltFileMgr(java.io.File allowed_directory) throws java.io.IOError, java.lang.SecurityException, java.lang.IllegalArgumentException
allowed_directory
- all files must appear under this directory.java.lang.IllegalArgumentException
- if allowed_directory is null.java.io.IOError
- for errors accessing directory information.java.lang.SecurityException
- if access to the allowed_directory is
denied for security reasons.public java.lang.String verify(java.lang.String data_source)
verify
in interface IQBPFileMgr
data_source
- this must be a file path.public java.lang.String verify(java.io.File data_file)
verify
in interface IQBPFileMgr
data_file
- a file object identifying the data source.public java.io.InputStream getReaderFor(java.lang.String data_source) throws java.io.FileNotFoundException, java.lang.IllegalArgumentException
getReaderFor
in interface IQBPFileMgr
data_source
- the path name of a standard file.java.io.FileNotFoundException
- if there is no such file, it is a directory,
or could not be opened for some other reason.java.lang.IllegalArgumentException
- if data_source is null, empty, or if
it doesn't meet the current sub-directory restrictions or if
access is denied for security reasons.public java.io.InputStream getReaderFor(java.io.File file_id) throws java.io.FileNotFoundException, java.lang.IllegalArgumentException
getReaderFor
in interface IQBPFileMgr
file_id
- the file to be read.java.io.FileNotFoundException
- if there is no such file.java.lang.IllegalArgumentException
- if file_id is null, or if access
is denied for security reasons.