Package org.infinispan.commons.util
Class AbstractFileLookup
- java.lang.Object
-
- org.infinispan.commons.util.AbstractFileLookup
-
- All Implemented Interfaces:
FileLookup
- Direct Known Subclasses:
FileLookupFactory.DefaultFileLookup
public abstract class AbstractFileLookup extends Object implements FileLookup
-
-
Constructor Summary
Constructors Constructor Description AbstractFileLookup()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract InputStream
getAsInputStreamFromClassLoader(String filename, ClassLoader cl)
protected abstract URL
getAsURLFromClassLoader(String filename, ClassLoader cl)
protected abstract Collection<URL>
getAsURLsFromClassLoader(String filename, ClassLoader cl)
InputStream
lookupFile(String filename, ClassLoader cl)
Looks up the file, see :FileLookupFactory.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 :FileLookupFactory.DefaultFileLookup
.InputStream
lookupFileStrict(URI uri, ClassLoader cl)
Looks up the file, see :FileLookupFactory.DefaultFileLookup
.
-
-
-
Method Detail
-
lookupFile
public InputStream lookupFile(String filename, ClassLoader cl)
Looks up the file, see :FileLookupFactory.DefaultFileLookup
.- Specified by:
lookupFile
in interfaceFileLookup
- 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.
-
getAsInputStreamFromClassLoader
protected abstract InputStream getAsInputStreamFromClassLoader(String filename, ClassLoader cl)
-
lookupFileStrict
public InputStream lookupFileStrict(String filename, ClassLoader cl) throws FileNotFoundException
Looks up the file, see :FileLookupFactory.DefaultFileLookup
.- Specified by:
lookupFileStrict
in interfaceFileLookup
- 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
-
lookupFileStrict
public InputStream lookupFileStrict(URI uri, ClassLoader cl) throws FileNotFoundException
Description copied from interface:FileLookup
Looks up the file, see :FileLookupFactory.DefaultFileLookup
.- Specified by:
lookupFileStrict
in interfaceFileLookup
- Parameters:
uri
- An absolute, hierarchical URI with a scheme equal to "file" that represents the file to lookup- Returns:
- an input stream to the file or null if nothing found through all lookup steps.
- Throws:
FileNotFoundException
- if file cannot be found
-
lookupFileLocation
public URL lookupFileLocation(String filename, ClassLoader cl)
- Specified by:
lookupFileLocation
in interfaceFileLookup
-
getAsURLFromClassLoader
protected abstract URL getAsURLFromClassLoader(String filename, ClassLoader cl)
-
lookupFileLocations
public Collection<URL> lookupFileLocations(String filename, ClassLoader cl) throws IOException
- Specified by:
lookupFileLocations
in interfaceFileLookup
- Throws:
IOException
-
getAsURLsFromClassLoader
protected abstract Collection<URL> getAsURLsFromClassLoader(String filename, ClassLoader cl) throws IOException
- Throws:
IOException
-
-