Skip to content

Use provider-compatible file deletion and truncation APIs - #18349

Open
zerolbsony wants to merge 3 commits into
apache:masterfrom
zerolbsony:provider-compatible-file-apis
Open

Use provider-compatible file deletion and truncation APIs#18349
zerolbsony wants to merge 3 commits into
apache:masterfrom
zerolbsony:provider-compatible-file-apis

Conversation

@zerolbsony

Copy link
Copy Markdown
Contributor

This PR updates file deletion and truncation operations to use NIO.2-compatible APIs so configured FileSystemProvider implementations can intercept these file operations.
Changes include:
Replacing direct File.delete() usage with Files.delete(...) / Files.deleteIfExists(...).
Adding FileUtils.truncateFile(...) based on FileChannel.open(Path, ...).
Replacing truncation paths that used FileOutputStream#getChannel().truncate(...).
Adding a GitHub Actions diff check to block newly introduced non-NIO.2 file APIs in Java changes.
This allows downstream integrations to control deletion/truncation behavior through NIO.2 providers while keeping existing behavior unchanged for the default local filesystem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant