Package org.emrick.project
Class ProjectPersistence
java.lang.Object
org.emrick.project.ProjectPersistence
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static voidcopyAndValidate(Path source, Path recoveryFile, com.google.gson.Gson gson) static Pathprivate static booleanisCompleteProject(Reader projectJson) 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).private static voidmoveReplace(Path source, Path destination) static PathrecoveryFile(Path projectPath) private static PathrecoveryFileFor(Path destination) static voidsave(Path destination, String jsonFileName, String projectJson, List<Path> projectFiles, com.google.gson.Gson gson) static voidsaveRecoverySnapshot(Path projectPath, String jsonFileName, String projectJson, List<Path> projectFiles, com.google.gson.Gson gson) private static Stringprivate static voidvalidateArchive(Path archive, com.google.gson.Gson gson) static voidvalidateProjectArchive(Path archive, com.google.gson.Gson gson) private static void
-
Field Details
-
RECOVERY_DIRECTORY
- See Also:
-
-
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
- 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
-
validateProjectArchive
public static void validateProjectArchive(Path archive, com.google.gson.Gson gson) throws IOException - Throws:
IOException
-
recoveryFileFor
- 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
- Throws:
IOException
-
isCompleteProject
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
- Throws:
IOException
-
sha256
- Throws:
IOException
-