Interface PersistenceStrategy
public interface PersistenceStrategy
Interface implemented by classes that can read and write configuration properties.
Implementations should be mappable to the file extension, or some unique key, that is the format
it supports reading from and writing to. While this was built for writing to disk, that is not a
hard requirement on new implementations.
This interface should not be used to obtain an arbitrary instance, as implementations may
greatly vary, and no data validation is performed to alert the consumer of the service what is or
is not supported. Filter results using the STRATEGY_EXTENSION service property.
This interface is for internal use only.
This code is experimental. While this interface is functional and tested, it may change or be removed in a future version of the library.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringService property key to get the file extension a particular strategy can operate upon. -
Method Summary
Modifier and TypeMethodDescriptionGets the extension handled by this strategy.read(InputStream inputStream) Reads the configuration properties from anInputStream.voidwrite(OutputStream outputStream, Dictionary<String, Object> properties) Writes the configuration properties to anOutputStream.
-
Field Details
-
STRATEGY_EXTENSION
Service property key to get the file extension a particular strategy can operate upon.- See Also:
-
-
Method Details
-
getExtension
String getExtension()Gets the extension handled by this strategy.- Returns:
- the extension (without the prefix
.) handled by this strategy
-
read
Reads the configuration properties from anInputStream. The stream will not be closed automatically.- Parameters:
inputStream- input stream where the properties will be read from- Returns:
- the properties read
- Throws:
IOException- thrown if the properties couldn't be read
-
write
Writes the configuration properties to anOutputStream. The stream will not be closed automatically.- Parameters:
outputStream- output stream where the properties will be writtenproperties- properties to write- Throws:
IOException- thrown if the properties couldn't be written
-