Class AtomicFileWriter

java.lang.Object
io.jenkins.plugins.configsplice.engine.AtomicFileWriter

public final class AtomicFileWriter extends Object
Replaces one file's contents through a same-directory temporary file (SRS section 13.2).

The guarantee callers depend on is not "the write succeeded" but "the target is either fully old or fully new, never truncated". Writing in place cannot offer that; a crash or a failed write halfway through leaves a config file that parses as neither.

The temporary file is a sibling of the target, never in the system temp directory. Two reasons, and the second is the important one: a rename is only atomic within a filesystem, and the temp file transiently holds the same content as the target — including any resolved credential — so it must inherit the workspace's access controls rather than a world-traversable temp directory's.