Package biz.onixs.util.settings
Class FileBasedSettings
- java.lang.Object
-
- biz.onixs.util.settings.Settings
-
- biz.onixs.util.settings.FileBasedSettings
-
public class FileBasedSettings extends Settings
The Settings implementation backed with the file. The keys values are case-sensitive.
-
-
Constructor Summary
Constructors Constructor Description FileBasedSettings(File stream)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voidflush(boolean metadata)Flushes file data to stable storage.FilegetStream()voidload()voidsetLong(String key, long value, boolean flush)Sets the value corresponding to the given key.-
Methods inherited from class biz.onixs.util.settings.Settings
getBoolean, getBoolean, getInteger, getInteger, getLong, getLong, getString, getString, isDefined, setBoolean, setBoolean, setInteger, setInteger, setLong, setString, setString
-
-
-
-
Constructor Detail
-
FileBasedSettings
public FileBasedSettings(File stream)
-
-
Method Detail
-
getStream
public File getStream()
-
flush
public void flush(boolean metadata) throws IOExceptionFlushes file data to stable storage.
Whenmetadataistrue, both file data and metadata (e.g., file size) are forced to disk. Whenfalse, only file data is flushed.- Parameters:
metadata- whether file metadata should also be flushed- Throws:
IOException- if the flush operation fails
-
load
public void load() throws IOException- Throws:
IOException
-
close
public void close() throws IOException- Throws:
IOException
-
setLong
public void setLong(String key, long value, boolean flush) throws IOException
Description copied from class:SettingsSets the value corresponding to the given key.- Overrides:
setLongin classSettings- Parameters:
key- keyvalue- valueflush- whether to save to persistent storage immediately- Throws:
IOException- if value storing failed
-
-