public class DiskInputStreamLocator extends Object implements InputStreamLocator
Constructor and Description |
---|
DiskInputStreamLocator(File dir)
Create a new input stream locator.
|
Modifier and Type | Method and Description |
---|---|
InputStream |
getInputStream(String filename)
Finds and opens an input stream to the file with the given filename.
|
long |
getSize(String filename)
Get the size in bytes of the given named resource.
|
private final File dir
public DiskInputStreamLocator(File dir) throws IOException
dir
- The directory in the local file system in which the
files should be locatedNullPointerException
- If the dir parameter is nullFileNotFoundException
- If the given path is not an existing directoryIOException
public InputStream getInputStream(String filename) throws IOException
getInputStream
in interface InputStreamLocator
filename
- The name (for example a file name) of the resourceIOException
- If there is any problem with locating or opening
the resourcepublic long getSize(String filename)
InputStreamLocator
getSize
in interface InputStreamLocator
filename
- The name (for example a file name) of the resouce