Delete and update contents in a CSV File

Hi All,

I am new to java . I am able to read the records from CSV file using BufferedReader and I am getting output like this

"100,a100,1b100" -->1st record

"200,b200,dc300" -->2nd record

"400,f344,ce888" -->3rd record.

Now I need some help in below requirements.

1.How to delete a specfic record?

2.If record already exists how to update the existing record with new values?

Please share your ideas or give me some code snippet..

Thanks in Advance

[512 byte] By [dominatora] at [2007-11-27 11:01:00]
# 1

1. Read data into memory. (appears you have already got this working)

2. Modify data

3. Write date back to file.

floundera at 2007-7-29 12:33:22 > top of Java-index,Java Essentials,Java Programming...
# 2

Or if each record is the same length and you are not inserting -

just modifying values in existing ones - you can use a

RandomAccess file.

http://java.sun.com/j2se/1.4.2/docs/api/java/io/RandomAccessFile.html

TuringPesta at 2007-7-29 12:33:22 > top of Java-index,Java Essentials,Java Programming...
# 3

No..records are different length.

And also I dont want to create a new file and rename the old file.

I have to do update and delete in the same file.

Any help or code snippet appreciated.

dominatora at 2007-7-29 12:33:22 > top of Java-index,Java Essentials,Java Programming...