FileLocator - apache/ctakes GitHub Wiki
Utility class that attempts to locate files.
-
Author: Mayo Clinic
$CTAKES_HOME is an environment variable that may be set to indicate the absolute directory path of the ctakes installation
-
Parameters:
-
locationsome absolute or relative resource location
-
-
Returns: a collection containing the location and the location with the prefix resources/
-
Parameters:
-
locationsome absolute or relative file location
-
-
Returns: a collection containing the location with prefixes created using the working directory, CTAKES_HOME, ctakes, and resources.
The working directory is traversed backwards to help developers that create projects at upper levels from ctakes.
-
Parameters:
-
locationsome absolute or relative resource or file location
-
-
Returns: a collection made from {@link #getUrlSearchPaths(String)} and {@link #getFileSearchPaths(String)}
Fetches stream Search order is by: 1. By resource stream in classpath 2. By file on filesystem 3. By resource url in classpath
-
Parameters:
-
locationsome string representing the full or partial location of a resource
-
- Returns: an input stream for the resource
-
Exceptions:
-
FileNotFoundExceptionif no resource could be found
-
static public InputStream getAsStream( final Class<?> clazz, final String location ) throws FileNotFoundException
Fetches stream Search order is by: 1. By resource stream in classpath 2. By file on filesystem 3. By resource url in classpath
-
Parameters:
-
clazzsome class whose classloader should be used -
locationsome string representing the full or partial location of a resource
-
- Returns: an input stream for the resource
-
Exceptions:
-
FileNotFoundExceptionif no resource could be found
-
Fetches stream without throwing exceptions. Search order is by: 1. By resource stream in classpath 2. By file on filesystem 3. By resource url in classpath
-
Parameters:
-
locationsome string representing the full or partial location of a resource
-
-
Returns: an input stream for the resource
Fetches stream without throwing exceptions. Search order is by: 1. By resource stream in classpath 2. By file on filesystem 3. By resource url in classpath
-
Parameters:
-
clazzsome class whose classloader should be used -
locationsome string representing the full or partial location of a resource
-
-
Returns: an input stream for the resource
Fetches stream without throwing exceptions only by finding a stream in the classpath
-
Parameters:
-
clazzsome class whose classloader should be used -
locationsome string representing the full or partial location of a resource
-
-
Returns: an input stream for the resource
Fetches resource. Search order is by: 1. By file on filesystem 2. By resource url in classpath
-
Parameters:
-
locationsome string representing the full or partial location of a resource
-
- Returns: an url for the resource
-
Exceptions:
-
FileNotFoundExceptionif no resource could be found
-
static public URL getResource( final Class<?> clazz, final String location ) throws FileNotFoundException
Fetches resource. Search order is by: 1. By file on filesystem 2. By resource url in classpath
-
Parameters:
-
clazzsome class whose classloader should be used -
locationsome string representing the full or partial location of a resource
-
- Returns: an url for the resource
-
Exceptions:
-
FileNotFoundExceptionif no resource could be found
-
Fetches resource without throwing exceptions. Search order is by: 1. By file on filesystem 2. By resource url in classpath
-
Parameters:
-
locationsome string representing the full or partial location of a resource
-
-
Returns: an url for the resource
Fetches resource without throwing exceptions. Search order is by: 1. By file on filesystem 2. By resource url in classpath
-
Parameters:
-
clazzsome class whose classloader should be used -
locationsome string representing the full or partial location of a resource
-
-
Returns: an url for the resource
Fetches resource without throwing exceptions only by finding a resource in the classpath
-
Parameters:
-
clazzsome class whose classloader should be used -
locationsome string representing the full or partial location of a resource
-
-
Returns: an url for the resource
Calls {@link #getFile(String)}
- Deprecated
@Deprecated static public File locateFile( final Class<?> clazz, final String location ) throws FileNotFoundException
Calls {@link #getFile(Class, String)}
-
Deprecated
Fetches file. Search order is by: 1. By file on filesystem 2. By resource url in classpath 3. By resource stream in classpath If a stream is found then it is copied to a temporary file and that file is returned.
-
Parameters:
-
locationsome string representing the full or partial location of a resource
-
- Returns: an file for the resource
-
Exceptions:
-
FileNotFoundExceptionif a file cannot be found or temporary file created
-
static public File getFile( final Class<?> clazz, final String location ) throws FileNotFoundException
Fetches file. Search order is by: 1. By file on filesystem 2. By resource url in classpath 3. By resource stream in classpath If a stream is found then it is copied to a temporary file and that file is returned.
-
Parameters:
-
clazzsome class whose classloader should be used -
locationsome string representing the full or partial location of a resource
-
- Returns: an file for the resource
-
Exceptions:
-
FileNotFoundExceptionif a file cannot be found or temporary file created
-
Fetches file without throwing exceptions. Search order is by: 1. By file on filesystem 2. By resource url in classpath 3. By resource stream in classpath If a stream is found then it is copied to a temporary file and that file is returned.
-
Parameters:
-
locationsome string representing the full or partial location of a resource
-
-
Returns: an file for the resource or null if none is found
Fetches file without throwing exceptions. Search order is by: 1. By file on filesystem 2. By resource url in classpath 3. By resource stream in classpath If a stream is found then it is copied to a temporary file and that file is returned.
-
Parameters:
-
clazzsome class whose classloader should be used -
locationsome string representing the full or partial location of a resource
-
-
Returns: an file for the resource or null if none is found
Fetches file without throwing exceptions only by finding an existing file in the filesystem.
-
Parameters:
-
locationsome string representing the full or partial location of a file
-
-
Returns: a discovered file or null
-
Parameters:
-
streaman input stream that exists within the classpath -
locationsome originally requested file location
-
-
Returns: a temporary file containing the contents of the stream
@Deprecated static public String getFullPath( final String relativePath ) throws FileNotFoundException
Calls a {@link #getFile(Class, String)} and returns the path of the file or "" if none.
-
Exceptions:
-
FileNotFoundExceptionif the file cannot be found
-
-
Deprecated
@Deprecated static public String getFullPath( final Class<?> clazz, final String relativePath ) throws FileNotFoundException
Calls a {@link #getFile(Class, String)} and returns the path of the file or "" if none.
-
Exceptions:
-
FileNotFoundExceptionif the file cannot be found
-
-
Deprecated
Calls a {@link #getFile(Class, String)} and returns the path of the file or "" if none.
-
Deprecated
@Deprecated static public String getFullPathQuiet( final Class<?> clazz, final String relativePath )
Calls a {@link #getFile(Class, String)} and returns the path of the file or "" if none.
- Deprecated