org.infinispan.util
Interface FileLookup

All Known Implementing Classes:
AbstractFileLookup, FileLookupFactory.DefaultFileLookup, FileLookupFactory.OsgiFileLookup

public interface FileLookup

Holds the logic of looking up a file, in the following sequence:

  1. try to load it with the current thread's context ClassLoader
  2. if fails, the system ClassLoader
  3. if fails, try to load it as a file from the disk

Use FileLookupFactory to obtain an instance of FileLookup. This will result in an extended version of FileLookup being used if in an OSGI environment.

Since:
4.0
Author:
Mircea.Markus@jboss.com, Pete Muir

Method Summary
 InputStream lookupFile(String filename, ClassLoader cl)
          Looks up the file, see : DefaultFileLookup.
 URL lookupFileLocation(String filename, ClassLoader cl)
           
 Collection<URL> lookupFileLocations(String filename, ClassLoader cl)
           
 InputStream lookupFileStrict(String filename, ClassLoader cl)
          Looks up the file, see : DefaultFileLookup.
 

Method Detail

lookupFile

InputStream lookupFile(String filename,
                       ClassLoader cl)
Looks up the file, see : DefaultFileLookup.

Parameters:
filename - might be the name of the file (too look it up in the class path) or an url to a file.
Returns:
an input stream to the file or null if nothing found through all lookup steps.

lookupFileStrict

InputStream lookupFileStrict(String filename,
                             ClassLoader cl)
                             throws FileNotFoundException
Looks up the file, see : DefaultFileLookup.

Parameters:
filename - might be the name of the file (too look it up in the class path) or an url to a file.
Returns:
an input stream to the file or null if nothing found through all lookup steps.
Throws:
FileNotFoundException - if file cannot be found

lookupFileLocation

URL lookupFileLocation(String filename,
                       ClassLoader cl)

lookupFileLocations

Collection<URL> lookupFileLocations(String filename,
                                    ClassLoader cl)
                                    throws IOException
Throws:
IOException

-->

Copyright © 2011 JBoss, a division of Red Hat. All Rights Reserved.