Skip to content

robtimus/io-functions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

io-functions

Maven Central Build Status Quality Gate Status Coverage Known Vulnerabilities

The io-functions library provides functional interfaces for I/O operations. These are basically copies of the functional interfaces in java.util.functions except their methods can throw IOExceptions.

Each of these interfaces also contains static methods unchecked and checked to convert them into their matching JSE equivalents. For example, to delete all files in a directory that match a filter, you can use IOConsumer.unchecked:

try (DirectoryStream<Path> stream = Files.newDirectoryStream(dir, filter)) {
    stream.forEach(unchecked(Files::delete));
} catch (UncheckedIOException e) {
    throw e.getCause();
}