Add callback function to Java stream
You can use the DELETE_ON_CLOSE
option:
Stream<Reader> stream = Files.list(Paths.get("myFolder"))
// TODO handle IOException
.map(path -> Files.newInputStream(path, StandardOpenOption.DELETE_ON_CLOSE))
.map(InputStreamReader::new)
.map(BufferedReader::new);