Reputation: 739
Java: Best way to store data in a file. I am doing a comparison between 2 versions of a file and then record the differences between the file as Insert, Deleted or Changed. The data needs to be logged in a similiar format >>
Version_old=1.28 Version_new=1.29
Operation=Changed,SourceLineFrom=55,SourceLineTo=55 TargetFileFrom=55 TargetFileTo= 55
Operation=Delete, SourceLineFrom=57,SourceLineTo=59 TargetFilefrom=57 TargetFileTo= -
The data is needed later on. Can anyone suggest me which is the best and easiest format to save this data? the data have to retrieved later on for processing.
Upvotes: 1
Views: 80
Reputation: 1
Another alternative is to store the data using JSON format. This is mainly possible because each change set is constructed as a name-value pair (a Map basically).
Upvotes: 0
Reputation: 1423
I would look at the format produced by git diff tool. It's clear, can easily be parsed, and I'm sure that there are existing parsers for it
Upvotes: 1
Reputation: 16677
too amny options to really be helpful.
it sounds like maybe XML - at least you get free parsers.
Upvotes: 0