Class Files

java.lang.Object
fr.formiko.kokcinelo.tools.Files

public class Files extends Object
Tool class to manage files.
Since:
0.2
Version:
0.2
  • Method Details

    • getDataPath

      public static String getDataPath()
      Returns:
      the data path depending of the OS.
    • getText

      public static HashMap<String,String> getText(String languageCode)
      Get the translated text from a json file. The file must be in the folder languages and have the name of the language code.
      Parameters:
      languageCode - language 2 or 3 char code of the file to load.
      Returns:
      the translated text.
    • getNumberOfText

      public static int getNumberOfText(String languageCode)
      Returns:
      The list of not null keys.
    • saveInFile

      public static void saveInFile(String fileName, Map<String,String> content)
      Save a map in a file.
      Parameters:
      fileName - name of the file to save data in
      content - data to save in file
    • loadFromFile

      public static Map<String,String> loadFromFile(String fileName, boolean internal)
      Load a map from a file.
      Parameters:
      fileName - name of the file to load data from
      internal - if the file is internal or not
      Returns:
      the data loaded from file
    • loadMapFromCSVFile

      public static Map<String,String> loadMapFromCSVFile(String fileName, boolean internal)
      Load a map from a file.
      Parameters:
      fileName - name of the file to load data from
      Returns:
      the data loaded from file
    • saveMapToCSVFile

      public static void saveMapToCSVFile(String fileName, Map<String,?> map)
      Save a map from a file.
      Parameters:
      fileName - name of the file to load data from
      map - the map to save
    • loadUniqueCharFromTranslationFiles

      public static String loadUniqueCharFromTranslationFiles()
      Load all existing char in the translation files. (And subsubfiles, and subsubsubfiles, etc.) It is used to know which char are used in the translation files to create the BitmapFont.
      Returns:
      all char that may be displayed from translation files.
    • loadContentOfFile

      public static String loadContentOfFile(com.badlogic.gdx.files.FileHandle file, boolean fromAssets)
      Load the content of a file and all its subfiles. (And subsubfiles, and subsubsubfiles, etc.) Don't work for internal files.
      Parameters:
      file - the file were to search.
      Returns:
      all content of the file and its subfiles.
    • listSubFilesPathsRecusvively

      public static Set<String> listSubFilesPathsRecusvively(String path)
      Parameters:
      path - the path of the directory to search
      Returns:
      all subfiles of a directory. (& sub sub files, & sub sub sub files, etc.)
    • listSubFilesRecusvively

      public static Set<com.badlogic.gdx.files.FileHandle> listSubFilesRecusvively(String path)
      Parameters:
      path - the path of the directory to search
      Returns:
      all subfiles of a directory. (& sub sub files, & sub sub sub files, etc.)
    • listSubDirectory

      public static Set<String> listSubDirectory(String path)
      Parameters:
      path - the path of the directory to search
      Returns:
      direct directory of a directory