Class AtomicFiles

java.lang.Object
io.jenkins.plugins.xmleditor.util.AtomicFiles

public final class AtomicFiles extends Object
Writes a file through a temporary file in the same directory, so readers never see a half-written file.

Unlike hudson.util.AtomicFileWriter, which is a character Writer, this writes the exact bytes produced by the lossless serializer (encoding, BOM and character references are already applied), keeps the permissions of the replaced file and writes through symbolic links instead of replacing them. Like it, the data is flushed to the disk before the rename.

  • Method Details

    • write

      public static void write(Path file, byte[] content) throws IOException
      Writes content; when file is a symbolic link the file it points to is replaced and the link kept.
      Throws:
      IOException