Dear all,
I am a
Java noob.
Is it possible to open a file and add new data to that file where some of this data may already exist?
I was thinking I could overwrite existing data so that I would not have to keep checking if certain data already exists each time before I add new data to the file.
For example, consider the following file that contains the following data:
Bob isA Person
Bob hasAge 25
Later, I may receive the following information that I'd like to append to the existing file:
Bob hasAge 25
Bob hasHairColour Brown
25 isA Integer
I dont want to have to verify that each statement has not already been added previously.
Is it possible to add "Bob hasAge 25" again but not as a duplicate rather just add and overwrite if it all ready exists?
Note, I don't want to remove existing content of the original file. That is, based on the original file and the new data, I'd like to end with the following new/updated file:
Bob isA Person
Bob hasAge 25
Bob hasHairColour Brown
25 isA Integer
(note the above example is an overly simplistic example but is useful to demonstrate my overall objective where I will be manipulating text-based documents).
Thanks in advance,
Paddy.