Class KarmaFile
java.lang.Object
ml.karmaconfigs.api.common.karmafile.KarmaFile
- All Implemented Interfaces:
Serializable
Karma file
- See Also:
- Serialized Form
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidApply karma file attribute to the filevoidcreate()Create the filevoiddelete()Delete the filebooleanexists()Get if the file existsvoidexportFromFile(InputStream resource)Export the karma file from an internal file@NotNull ObjectGet a valuebooleangetBoolean(String path, boolean def)Get a valuebyteGet a valuebyte[]Get a valuedoubleGet a valuegetFile()Get the filefloatGet a valueintGet a valuegetKeys(boolean deep)Get the karma file key set@NotNull List<?>Get a valuelongGet a valueshortGet a value@NotNull StringGet a valuegetStringList(String path, String... default_contents)Get a valuebooleanGet if a key is a listbooleanGet if a key is setRead the file completelyvoidSet a new valuevoidSet a new valuevoidSet a new valuetoString()Get the karma file as stringvoidUnset a key and its value if setvoidUnset a list
-
Constructor Details
-
KarmaFile
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
-
KarmaFile
Initialize the karma file- Parameters:
target- the target karma file
-
KarmaFile
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
-
applyKarmaAttribute
public void applyKarmaAttribute()Apply karma file attribute to the file -
create
public void create()Create the file -
set
Set a new value- Parameters:
value- the value
-
set
Set a new value- Parameters:
path- the key pathvalue- the value
-
set
Set a new value- Parameters:
path- the key pathlist- the values
-
unset
Unset a key and its value if set- Parameters:
path- the key path
-
unsetList
Unset a list- Parameters:
path- the list path
-
delete
public void delete()Delete the file -
get
Get a value- Parameters:
path- the value pathdef- the default value- Returns:
- the value
-
getString
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
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
-
getFloat
Get a value- Parameters:
path- the value pathdef- the default value- Returns:
- the value
-
getShort
Get a value- Parameters:
path- the value pathdef- the default value- Returns:
- the value
-
getByte
Get a value- Parameters:
path- the value pathdef- the default value- Returns:
- the value
-
getBytes
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
-