user1401472
user1401472

Reputation: 2301

How do I remove a line from a CSV file using Super CSV?

I am little new to Super CSV. Just wanted to check if there is provision to delete or modify a line in a CSV file?

Looking at the source, I do not see use of RandomAccessFile in rw mode. Any way to customize this?

Upvotes: 1

Views: 1024

Answers (1)

James Bassett
James Bassett

Reputation: 9918

Super CSV doesn't support editing CSV files.

The quick and dirty solution would be to create a copy of the CSV file (i.e. read in each line with Super CSV, then write it out to a different file). You can choose whether to modify the data or to omit a line very easily.

As you've probably seen, Super CSV works with Readers/Writers. It might be possible to write your own Reader/Writer that wraps RandomAccessFile which could then be used by Super CSV, but it might just be simpler to make a copy.

Upvotes: 1

Related Questions