Someone knows way to write and read from file (xml, json) in java where java object will be able to store in file in reactive way.
For now I use
com.fasterxml.jackson.core.JsonGenerator
to write objects to json file.
For reading from file I'm using
com.fasterxml.jackson.core.JsonParser
but I'm not able to write and read from file in the same time. I don't want to have many open/close file descriptor operations.
It's way to do it in java?
My business scenario:
I read records from one big file ( more then couple of GB) and I need to create relations between records. Records in input file unfortunetlly are not sorted and it's imposible to write to sort file when all records are in perfect order.
I iterate over input file and find parent record
and want to write the record to second file when I was created realations between records.
In second step I want to write child record
but I need to iterate over record relations file
(read file operation with open write descriptor) and I need to find find parent record
for my child record
and update that parent record when I fill child structure
where insert child_1 element
example structure used by me right now:
{
"parent_1": {
...
childs: [{
"child_1": { ... }
}]
}
}