Class Checkpoint.Writer

java.lang.Object
com.quantfinlib.persist.Checkpoint.Writer
All Implemented Interfaces:
Closeable, AutoCloseable
Enclosing class:
Checkpoint

public static final class Checkpoint.Writer extends Object implements Closeable
Collects named sections and commits them atomically on close.
  • Method Details

    • section

      public Checkpoint.Writer section(String name, Checkpoint.StateWriter body) throws IOException
      Serializes one model's state under name. A duplicate name or a throwing body marks the writer failed: close() then commits nothing, so a half-written model can never replace a good file.
      Throws:
      IOException
    • close

      public void close() throws IOException
      Commits: temp file beside the target, then atomic rename over it (plain replace on filesystems without atomic rename — see the class javadoc's durability caveat).
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException