Class FileProvider
java.lang.Object
com.ibm.wala.core.util.io.FileProvider
- Direct Known Subclasses:
EclipseFileProvider
This class provides files that are packaged with this plug-in
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfilePathFromURL
(URL url) Properly creates the String file name of aURL
.getFile
(String fileName, ClassLoader loader) getFileFromClassLoader
(String fileName, ClassLoader loader) getInputStreamFromClassLoader
(String fileName, ClassLoader loader) First tries to read fileName from the ClassLoader loader.getJarFileFromClassLoader
(String fileName, ClassLoader loader) getJarFileModule
(String fileName) getJarFileModule
(String fileName, ClassLoader loader) getResource
(String fileName) getResource
(String fileName, ClassLoader loader)
-
Constructor Details
-
FileProvider
public FileProvider()
-
-
Method Details
-
getJarFileModule
- Returns:
- the jar file packaged with this plug-in of the given name, or null if not found.
- Throws:
IOException
-
getJarFileModule
- Throws:
IOException
-
getResource
-
getResource
-
getFile
- Throws:
IOException
-
getFile
- Throws:
IOException
-
getFileFromClassLoader
public File getFileFromClassLoader(String fileName, ClassLoader loader) throws FileNotFoundException - Throws:
FileNotFoundException
-
getInputStreamFromClassLoader
public InputStream getInputStreamFromClassLoader(String fileName, ClassLoader loader) throws FileNotFoundException First tries to read fileName from the ClassLoader loader. If unsuccessful, attempts to read file from the file system. If that fails, throws aFileNotFoundException
- Throws:
FileNotFoundException
-
getJarFileFromClassLoader
- Returns:
- the jar file packaged with this plug-in of the given name, or null if not found: wrapped as a JarFileModule or a NestedJarFileModule
- Throws:
IOException
-
filePathFromURL
Properly creates the String file name of aURL
. This works around a bug in the Sun implementation ofURL.getFile()
, which doesn't properly handle file paths with spaces (see bug report). For now, fails with an assertion if the url is malformed.- Returns:
- the path name for the url
- Throws:
IllegalArgumentException
- if url is null
-