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