@@ -83,6 +83,24 @@ public FrameRecorder(Path outputPath, RecordingStrategy strat) {
8383 logger .info ("Initializing FrameRecorder with output path: " + outputPath .toString ());
8484 this .outputPath = outputPath ;
8585
86+ // Write strategy to a file in the output path
87+ try {
88+ // Ensure output directory exists
89+ java .nio .file .Files .createDirectories (outputPath );
90+
91+ java .nio .file .Path strategyFile = outputPath .resolve ("strat" );
92+ String content = strat .name () + System .lineSeparator ();
93+
94+ java .nio .file .Files .write (
95+ strategyFile ,
96+ content .getBytes (java .nio .charset .StandardCharsets .UTF_8 ),
97+ java .nio .file .StandardOpenOption .CREATE ,
98+ java .nio .file .StandardOpenOption .TRUNCATE_EXISTING );
99+ } catch (Exception e ) {
100+ logger .warn (
101+ "Failed to write recording strategy file to " + outputPath + ": " + e .getMessage ());
102+ }
103+
86104 this .frameQueue = new ArrayBlockingQueue <>(QUEUE_CAPACITY );
87105 this .recording = new AtomicBoolean (false );
88106 this .shutdown = new AtomicBoolean (false );
@@ -214,4 +232,26 @@ public void release() {
214232 }
215233 }
216234 }
235+
236+ /**
237+ * Export a recording at the given path.
238+ *
239+ * @param recording Path to recording directory
240+ * @return Path to exported recording
241+ */
242+ public static Path export (Path recording ) throws Exception {
243+ // Read the strategy used
244+
245+ java .nio .file .Path strategyFile = recording .resolve ("strat" );
246+ String strategy = java .nio .file .Files .readString (strategyFile ).trim ();
247+
248+ RecordingStrategy strat =
249+ switch (strategy ) {
250+ case "SNAPSHOTS" -> RecordingStrategy .SNAPSHOTS ;
251+ default ->
252+ throw new IllegalArgumentException ("Unsupported Recording Strategy: " + strategy );
253+ };
254+
255+ throw new UnsupportedOperationException ("Export has not been implemented" );
256+ }
217257}
0 commit comments