user1688404
user1688404

Reputation: 739

Best way to create a file and then use the data later

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

Answers (3)

userhiren
userhiren

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

RA.
RA.

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

Randy
Randy

Reputation: 16677

too amny options to really be helpful.

it sounds like maybe XML - at least you get free parsers.

Upvotes: 0

Related Questions