Class ProjectPersistence

java.lang.Object
org.emrick.project.ProjectPersistence

public final class ProjectPersistence extends Object
  • Field Details

  • Constructor Details

    • ProjectPersistence

      private ProjectPersistence()
  • Method Details

    • save

      public static void save(Path destination, String jsonFileName, String projectJson, List<Path> projectFiles, com.google.gson.Gson gson) throws IOException
      Throws:
      IOException
    • recoveryFile

      public static Path recoveryFile(Path projectPath) throws IOException
      Throws:
      IOException
    • saveRecoverySnapshot

      public static void saveRecoverySnapshot(Path projectPath, String jsonFileName, String projectJson, List<Path> projectFiles, com.google.gson.Gson gson) throws IOException
      Throws:
      IOException
    • getRecoveryDirectory

      public static Path getRecoveryDirectory()
    • validateProjectArchive

      public static void validateProjectArchive(Path archive, com.google.gson.Gson gson) throws IOException
      Throws:
      IOException
    • recoveryFileFor

      private static Path recoveryFileFor(Path destination) throws IOException
      Throws:
      IOException
    • writeArchive

      private static void writeArchive(Path archive, String jsonFileName, String projectJson, List<Path> projectFiles) throws IOException
      Throws:
      IOException
    • copyAndValidate

      private static void copyAndValidate(Path source, Path recoveryFile, com.google.gson.Gson gson) throws IOException
      Throws:
      IOException
    • validateArchive

      private static void validateArchive(Path archive, com.google.gson.Gson gson) throws IOException
      Throws:
      IOException
    • isCompleteProject

      private static boolean isCompleteProject(Reader projectJson) throws IOException
      Streams through the whole project JSON, so a truncated or malformed file is rejected, without building the project in memory (large shows can be hundreds of MB of JSON). Accepts every format MediaEditorGUI.loadProjectData can open: the current format (archiveNames) and the legacy single-archive format (archivePath), which is upgraded on the next save.
      Throws:
      IOException
    • moveReplace

      private static void moveReplace(Path source, Path destination) throws IOException
      Throws:
      IOException
    • sha256

      private static String sha256(String value) throws IOException
      Throws:
      IOException