com.novell.nds.dirxml.util.mail
Class FileSource

java.lang.Object
  extended bycom.novell.nds.dirxml.util.mail.FileSource
Direct Known Subclasses:
XmlDocumentSource

public class FileSource
extends Object

Class that will load file data from the file system or from the directory


Constructor Summary
FileSource(String dnBase, File pathBase)
          Construct a FileSource with the passed bases.
 
Method Summary
 InputStream getFile(String filename)
          Return an open InputStream from which to read the bytes of the file with the passed filename.
 InputStream getFile(String path, String[] baseURI)
          Return an open InputStream from which to read the bytes of the file with the passed filename.
 String resolveFilename(String filename)
          Resolve a file system filename with the pathBase we have in this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileSource

public FileSource(String dnBase,
                  File pathBase)
Construct a FileSource with the passed bases.

Parameters:
dnBase - Base location for objects in directory.
pathBase - Base location for files in file system.
Method Detail

getFile

public InputStream getFile(String filename)
                    throws IOException
Return an open InputStream from which to read the bytes of the file with the passed filename. The directory is tried first, then the file system.

Parameters:
filename - The name of the file to get.
Throws:
IOException - if data cannot be found

getFile

public InputStream getFile(String path,
                           String[] baseURI)
                    throws IOException
Return an open InputStream from which to read the bytes of the file with the passed filename. The directory is tried first, then the file system.

Parameters:
path - The name of the file to get.
baseURI - An array (of at least one) String in which to return the URI of the found data. (May be null)
Returns:
the opened InputStream or null if not found
Throws:
IOException - if data cannot be found

resolveFilename

public String resolveFilename(String filename)
                       throws FileNotFoundException
Resolve a file system filename with the pathBase we have in this object.

Parameters:
filename - Filename to resolve.
Throws:
FileNotFoundException