As I like to say, java.nio.file is like a big wooden crate with some diagrams, but it does not actually contain any useful content.

I had to solve a problem yesterday and wrote this It will detect the content type of a file, bu actually inspecting the first couple of bytes of a file rather than guessing it from the file extension. It uses Apache Tika underneath to do the real work. This allows the java.nio.file.FIles.probeFIieContent(Path) method to actually do something useful and not just return null. \o/

I am posting this here as the repo contains three functionally equivalant implementations - Java, Groovy & Kotlin. (The published artifact on BIntray is the Java one, simply because I did not want to add an additional dependency for such a small implementation). At some stage I'll get around to comparing the performance of the three implementations

This will form part of something else I want to do is showing how to write NIO2 providers in alternative JVM languages.

In the mean-time this might be of interest to those who would like to compare implementations.

Schalk W. Cronjé
Twitter / Ello / Toeter : @ysb33r