Class AsyncKarmaFile
java.lang.Object
ml.karmaconfigs.api.common.karmafile.AsyncKarmaFile
- All Implemented Interfaces:
Serializable
Karma file
- See Also:
- Serialized Form
-
Constructor Summary
ConstructorsConstructorDescriptionAsyncKarmaFile(File target)Initialize the karma fileAsyncKarmaFile(Path target)Initialize the karma fileAsyncKarmaFile(KarmaSource source, String name, String... dir)Initialize the karma file -
Method Summary
Modifier and TypeMethodDescriptionApply karma file attribute to the filecreate()Create the filevoiddelete()Delete the filebooleanexists()Get if the file existsexportFromFile(InputStream resource)Export the karma file from an internal file@NotNull LateScheduler<Object>Get a valuegetBoolean(String path, boolean def)Get a valueGet a valuegetFile()Get the fileGet a valuegetKeys(boolean deep)Get the karma file key set@NotNull LateScheduler<List<?>>Get a valueGet a value@NotNull LateScheduler<String>Get a value@NotNull LateScheduler<List<String>>getStringList(String path, String... default_contents)Get a valueGet if a key is a listGet if a key is set@NotNull LateScheduler<List<String>>Read the file completelySet a new valueSet a new valueSet a new valuetoString()Get the karma file as stringUnset a key and its value if setUnset a list
-
Constructor Details
-
AsyncKarmaFile
Initialize the karma file- Parameters:
source- the file sourcename- the file namedir- the file path- Throws:
IllegalStateException- if the target path is not a valid path
-
AsyncKarmaFile
Initialize the karma file- Parameters:
target- the target karma file
-
AsyncKarmaFile
Initialize the karma file- Parameters:
target- the target karma file
-
-
Method Details
-
exportFromFile
Export the karma file from an internal file- Parameters:
resource- the internal file- Returns:
- the result
-
applyKarmaAttribute
Apply karma file attribute to the file- Returns:
- the result
-
create
Create the file- Returns:
- the result
-
set
Set a new value- Parameters:
value- the value- Returns:
- the result
-
set
Set a new value- Parameters:
path- the key pathvalue- the value- Returns:
- the result
-
set
Set a new value- Parameters:
path- the key pathlist- the values- Returns:
- the result
-
unset
Unset a key and its value if set- Parameters:
path- the key path- Returns:
- the result
-
unsetList
Unset a list- Parameters:
path- the list path- Returns:
- the result
-
delete
public void delete()Delete the file -
get
Get a value- Parameters:
path- the value pathdef- the default value- Returns:
- the value
-
getString
@NotNull public @NotNull LateScheduler<String> getString(String path, @NotNull @NotNull String def)Get a value- Parameters:
path- the value pathdef- the default value- Returns:
- the value
-
getList
Get a value- Parameters:
path- the value pathdefault_contents- the default values- Returns:
- the value
-
getStringList
@NotNull public @NotNull LateScheduler<List<String>> getStringList(String path, String... default_contents)Get a value- Parameters:
path- the value pathdefault_contents- the default values- Returns:
- the value
-
readFullFile
Read the file completely- Returns:
- the file lines
-
getBoolean
Get a value- Parameters:
path- the value pathdef- the default value- Returns:
- the value
-
isList
Get if a key is a list- Parameters:
path- the key- Returns:
- if the path is a list
-
isSet
Get if a key is set- Parameters:
path- the key- Returns:
- if the path is set
-
getInt
Get a value- Parameters:
path- the value pathdef- the default value- Returns:
- the value
-
getDouble
Get a value- Parameters:
path- the value pathdef- the default value- Returns:
- the value
-
getLong
Get a value- Parameters:
path- the value pathdef- the default value- Returns:
- the value
-
getFile
Get the file- Returns:
- the file
-
exists
public boolean exists()Get if the file exists- Returns:
- if the file exists
-
getKeys
Get the karma file key set- Parameters:
deep- include non-valued keys- Returns:
- the karma file keys
-
toString
Get the karma file as string
-