Write to a temp file in the same directory, then `Files.move` with `ATOMIC_MOVE` to the target. Readers never see a half-written file — critical for config / state files.
`Path` (NIO) replaces `File` for new code. Operator-like methods compose paths cleanly across OSes — and the underlying file isn't touched until you do I/O.
`Files.walk` returns a lazy Stream over every entry under a path. Filter with stream operations; remember to close the stream (or use try-with-resources).
`java.nio.file.Files` shipped these convenience helpers in Java 8/11. Way cleaner than the legacy `FileReader` + `BufferedReader` ceremony for small/medium files.
For large files or line-oriented protocols, wrap a Reader/Writer in `Buffered*`. Reduces per-call overhead from many small reads to fewer large ones. Always close with try-with-resources.