Lambdas can throw checked exceptions, if the functional interface has defined it. For instance, if you tweak the
extractFileData method a bit, it is now allowed to throw IOException:
I actually got so annoyed by the number of times I had to catch IOException and wrap it (in an UncheckedIOException, the best wrapper for IOExceptions since
Java 8), I wrote a copy of all interfaces in
java.util.function:
https://robtimus.github.io/io-functions/. All can quite easily be converted to their equivalent in
java.util.function using the provided
unchecked methods.
I've also written an SQLException equivalent at
https://robtimus.github.io/sql-functions/, but I doubt that will be used often.