Java: Rule to use API of resources, streams, files not overcomplicated

Hi

Java file API with Streams, Resources, NIO and old File is really complicated to make it right. You normally first have to look on Stackoverflow to get it right.
I would love to see some rules flagging overcomplicated usage of API:

Noncompliant example:
byte[] foo = Files.readAllBytes(new File(this.getClass().getClassLoader().getResource("foo.txt").getFile()).toPath());

Compliant example:
byte[] foo = this.getClass().getClassLoader().getResourceAsStream("foo.txt").readAllBytes();

I fear there is a long list of possible bad usages.

Kind regards,
Michael