Created
September 18, 2021 11:21
-
-
Save GaetanoPiazzolla/a062860defaf93c15453614055fc5b37 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
related to medium article https://gae-piaz.medium.com/search-string-in-file-with-java-as-fast-as-possible-fedafdc7a3ee