List directory content with Project Reactor and DirectoryStream
问题 I'd like to use DirectoryStream with Project Reactor to list all the files in a directory. My try is: Path myDir = Paths.get("C:\\Users\\r.dacanal\\Documents\\Reply\\EDA\\logging-consumer\\input"); DirectoryStream<Path> directoryStream = Files.newDirectoryStream(myDir); Flux.fromIterable(directoryStream).doOnNext(s -> System.out.println(s)).subscribe(); But I'm getting the following Exception: Caused by: java.lang.IllegalStateException: Iterator already obtained at sun.nio.fs