Package one.microstream.cache
Interface CacheConfigurationLoader
- All Known Implementing Classes:
CacheConfigurationLoader.InputStreamConfigurationLoader
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface CacheConfigurationLoader
Loader for external configuration resources.
Supported resource types:
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
CacheConfigurationLoader.Defaults
static class
CacheConfigurationLoader.InputStreamConfigurationLoader
-
Method Summary
Modifier and Type Method Description static CacheConfigurationLoader
FromInputStream(InputStream inputStream)
Tries to load the configuration from theInputStream
inputStream
.static CacheConfigurationLoader
FromInputStream(InputStream inputStream, Charset charset)
Tries to load the configuration from theInputStream
inputStream
.static String
load(String path)
Loads the configuration from the given resource.static String
load(String path, Charset charset)
Loads the configuration from the given resource.String
loadConfiguration()
Loads the configuration from the given resource.static String
loadFromFile(File file)
Tries to load the configuration fromfile
.static String
loadFromFile(File file, Charset charset)
Tries to load the configuration fromfile
.static String
loadFromPath(Path path)
Tries to load the configuration frompath
.static String
loadFromPath(Path path, Charset charset)
Tries to load the configuration frompath
.static String
loadFromUrl(URL url)
Tries to load the configuration from the URLurl
.static String
loadFromUrl(URL url, Charset charset)
Tries to load the configuration from the URLurl
.
-
Method Details
-
loadConfiguration
String loadConfiguration()Loads the configuration from the given resource.- Returns:
- the configuration resource's content.
- Throws:
CacheConfigurationException
- if an error occurs while loading the resource
-
load
Loads the configuration from the given resource.The load order is as follows:
- The classpath
- As an URL
- As a file
- Parameters:
path
- a classpath resource, a file path or an URL- Returns:
- the configuration resource's content.
- Throws:
CacheConfigurationException
- if an error occurs while loading the resource
-
load
Loads the configuration from the given resource.The load order is as follows:
- The classpath
- As an URL
- As a file
- Parameters:
path
- a classpath resource, a file path or an URLcharset
- the charset used to load the configuration- Returns:
- the configuration resource's content.
- Throws:
CacheConfigurationException
- if an error occurs while loading the resource
-
loadFromPath
Tries to load the configuration frompath
.- Parameters:
path
- file system path- Returns:
- the configuration
- Throws:
CacheConfigurationException
- if the configuration couldn't be loaded
-
loadFromPath
Tries to load the configuration frompath
.- Parameters:
path
- file system pathcharset
- the charset used to load the configuration- Returns:
- the configuration
- Throws:
CacheConfigurationException
- if the configuration couldn't be loaded
-
loadFromFile
Tries to load the configuration fromfile
.- Parameters:
file
- file path- Returns:
- the configuration
- Throws:
CacheConfigurationException
- if the configuration couldn't be loaded
-
loadFromFile
Tries to load the configuration fromfile
.- Parameters:
file
- file pathcharset
- the charset used to load the configuration- Returns:
- the configuration
- Throws:
CacheConfigurationException
- if the configuration couldn't be loaded
-
loadFromUrl
Tries to load the configuration from the URLurl
.- Parameters:
url
- URL path- Returns:
- the configuration
- Throws:
CacheConfigurationException
- if the configuration couldn't be loaded
-
loadFromUrl
Tries to load the configuration from the URLurl
.- Parameters:
url
- URL pathcharset
- the charset used to load the configuration- Returns:
- the configuration
- Throws:
CacheConfigurationException
- if the configuration couldn't be loaded
-
FromInputStream
Tries to load the configuration from theInputStream
inputStream
.- Parameters:
inputStream
- the stream to read from- Returns:
- the configuration
- Throws:
CacheConfigurationException
- if the configuration couldn't be loaded
-
FromInputStream
Tries to load the configuration from theInputStream
inputStream
.- Parameters:
inputStream
- the stream to read fromcharset
- the charset used to load the configuration- Returns:
- the configuration
- Throws:
CacheConfigurationException
- if the configuration couldn't be loaded
-