Skip to content

Instantly share code, notes, and snippets.

@GaetanoPiazzolla
Created September 18, 2021 11:21
Show Gist options
  • Save GaetanoPiazzolla/a062860defaf93c15453614055fc5b37 to your computer and use it in GitHub Desktop.
Save GaetanoPiazzolla/a062860defaf93c15453614055fc5b37 to your computer and use it in GitHub Desktop.
import reactor.core.publisher.*;
import java.nio.file.Path;
public Flux<String> searchReactive() {
Path ipPath = Path.of(pathFile);
return Flux.using(
() -> Files.lines(ipPath),
Flux::fromStream,
Stream::close)
.filter(l -> l.contains(SEARCH_TOKEN))
.map(s -> s + "\r\n");
}
@GaetanoPiazzolla
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment