Class KarmaInputFile

java.lang.Object
ml.karmaconfigs.api.common.karmafile.KarmaInputFile
All Implemented Interfaces:
Serializable

public final class KarmaInputFile extends Object implements Serializable
Karma file only for input stream and used only to read
See Also:
Serialized Form
  • Constructor Details

    • KarmaInputFile

      public KarmaInputFile(InputStream stream)
      Initialize the karma file
      Parameters:
      stream - the file to read
  • Method Details

    • get

      @NotNull public @NotNull Object get(String path, @NotNull @NotNull Object def)
      Get a value
      Parameters:
      path - the value path
      def - the default value
      Returns:
      the value
    • getString

      @NotNull public @NotNull String getString(String path, @NotNull @NotNull String def)
      Get a value
      Parameters:
      path - the value path
      def - the default value
      Returns:
      the value
    • getList

      @NotNull public @NotNull List<?> getList(String path, Object... default_contents)
      Get a value
      Parameters:
      path - the value path
      default_contents - the default values
      Returns:
      the value
    • getStringList

      @NotNull public @NotNull List<String> getStringList(String path, String... default_contents)
      Get a value
      Parameters:
      path - the value path
      default_contents - the default values
      Returns:
      the value
    • readFullFile

      @NotNull public @NotNull List<String> readFullFile()
      Read the file completely
      Returns:
      the file lines
    • getBoolean

      public boolean getBoolean(String path, boolean def)
      Get a value
      Parameters:
      path - the value path
      def - the default value
      Returns:
      the value
    • isList

      public boolean isList(String path)
      Get if a key is a list
      Parameters:
      path - the key
      Returns:
      if the path is a list
    • isSet

      public boolean isSet(String path)
      Get if a key is set
      Parameters:
      path - the key
      Returns:
      if the path is set
    • getInt

      public int getInt(String path, int def)
      Get a value
      Parameters:
      path - the value path
      def - the default value
      Returns:
      the value
    • getDouble

      public double getDouble(String path, double def)
      Get a value
      Parameters:
      path - the value path
      def - the default value
      Returns:
      the value
    • getLong

      public long getLong(String path, long def)
      Get a value
      Parameters:
      path - the value path
      def - the default value
      Returns:
      the value
    • getKeys

      public Set<Key> getKeys(boolean deep)
      Get the karma file key set
      Parameters:
      deep - include non-valued keys
      Returns:
      the karma file keys
    • toString

      public String toString()
      Get the karma file as string
      Overrides:
      toString in class Object
      Returns:
      the karma file as string