Skip to main content
1 of 2
Carla
  • 3.4k
  • 9
  • 48
  • 81

Read Lines using Vert.x and RX2Java


I'm reading a property file using Vert.x File System API and would need to do some transformations on it. The problem is that the File is not being read line by line but as a single chunk. So, assuming I have this property file:
name=abc name=def 

And using this code:

vertx.fileSystem().rxReadFile("/path/file.properties") .map(buffer -> buffer.toString()) .subscribe(data -> { System.out.println(">"+data); }, err -> System.out.println("Cannot read the file: " + err.getMessage())); 

What I get printed is a single chunk of data:

>name=abc name=def 

I'd expect the following, as I have to perform transformations on each line:

>name=abc >name=def 

any help?

Carla
  • 3.4k
  • 9
  • 48
  • 81