Class ImportExportStorage

java.lang.Object
dev.chicoferreira.lifestealer.user.persistent.ImportExportStorage

public class ImportExportStorage extends Object
This class is responsible for importing and exporting user data to and from files.
  • Constructor Details

  • Method Details

    • importFromFile

      public int importFromFile(String path) throws Exception
      Imports every user from a file. This file must be a JSON file containing an array of LifestealerUser.

      The format of the file format should follow the default serialization format of LifestealerUser in GSON.

      Parameters:
      path - The path to the file to import from
      Returns:
      The number of users imported
      Throws:
      Exception - If an error occurs while importing
    • exportToFile

      public int exportToFile(String path) throws Exception
      Exports every user to a file.
      Parameters:
      path - The path to the file to export to
      Returns:
      The number of users exported
      Throws:
      Exception - If an error occurs while exporting
    • listFiles

      public List<Path> listFiles()
      Returns a list of all files in the base directory.
      Returns:
      A list of all files in the base directory