I'm not sure if this is the correct place for this.
I thought that file systems are pluggable. This here looks like hardcoded rules for specific file systems.

is there a way to move this code into the DistributedFileSystem (and S3) implementation?

The `FileOutputFormat` also contains specific `file:///` scheme code. I'm think In/Outputformats are independent of the filesystems (e.g. the file systems provide a data stream and the IF/OF converts it into an internal representation?)