public class IOUtils extends Object
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_DIRECTORY
The default directory to search for features.
|
static String |
DEFAULT_FEATURE_FILE
The default name of the feature file.
|
static String |
EXTENSION_FEATURE_FILE
The extension for a feature file.
|
static String |
EXTENSION_REF_FILE
The extension for a reference file.
|
Constructor and Description |
---|
IOUtils() |
Modifier and Type | Method and Description |
---|---|
static List<String> |
getFeatureFiles(File homeDirectory,
String... files)
Get the list of feature files.
|
static File |
getFileFromURL(URL url,
boolean cache,
File tmpDir)
Get a File from a local URL (if possible)
|
static JarFile |
getJarFileFromURL(URL url,
boolean cache,
File tmpDir)
Get a JarFile from a local URL (if possible)
|
static List<String> |
parseFeatureRefFile(File file)
Parse a feature reference file
|
public static final String EXTENSION_REF_FILE
public static final String EXTENSION_FEATURE_FILE
public static final String DEFAULT_DIRECTORY
public static final String DEFAULT_FEATURE_FILE
public static List<String> parseFeatureRefFile(File file) throws IOException
file
- The fileIOException
- If reading failspublic static List<String> getFeatureFiles(File homeDirectory, String... files) throws IOException
null
or an empty array, the default is used.
The default checks for the following places, the first one found is used. If none is
found an empty list is returned.
DEFAULT_DIRECTORY
in the current directory
DEFAULT_FEATURE_FILE
in the current directory
DEFAULT_DIRECTORY
in the home directory
DEFAULT_FEATURE_FILE
in the home directory
EXTENSION_FEATURE_FILE
or
EXTENSION_REF_FILE
of that directory are read.
If a file ends in EXTENSION_REF_FILE
the contents is read and every line not
starting with the hash sign is considered a reference to a feature artifact.homeDirectory
- If relative files should be resolved, this is the directory to usefiles
- Optional list of files. If none is provided, a default is used.IOException
- If an error occurs.public static File getFileFromURL(URL url, boolean cache, File tmpDir) throws IOException
url
- a local url (like a file: url or a jar:file: urlcache
- if an attempt should be made to download the content of the url locally
if it can not be presented as a file directlytmpDir
- the tmpDir to use (null for default)IOException
public static JarFile getJarFileFromURL(URL url, boolean cache, File tmpDir) throws IOException
url
- a local url (like a file: url or a jar:file: urlcache
- if an attempt should be made to download the content of the url locally
if it can not be presented as a jarfile directlytmpDir
- the tmpDir to use (null for default)IOException
- if the url can't be represented as a jarfileCopyright © 2007–2019 The Apache Software Foundation. All rights reserved.