Forums Register Login

Problem creating CSV file with writeAll method of CSVWriter

+Pie Number of slices to send: Send
hi ,

I am having problem in writing csv file.
List<String[]> has proper values .
But when i use



It creates the Blank file with no records.
please try to help me in figuring out this problem.
+Pie Number of slices to send: Send
I'll be assuming the following:
- CSVWriter means au.com.bytecode.opencsv.CSVWriter, as part of opencsv
- WriteAll should be writeAll

What happens if you call csvWriter.flush() and, more importantly, csvWriter.close()? Since you should always close all your streams when you're done with them.
+Pie Number of slices to send: Send
@Rob sorry it was my bad !
In my code it is writeAll . Still the records are not written on the file.
Is the syntax is wrong ? or whats the problem i did not getting.

+Pie Number of slices to send: Send
thanks Rob.

I was not closing the streams.
+Pie Number of slices to send: Send
why I am not able to flust the CSVWriter object ?
whereas Writer is getting flushed.
Can not get flush method for CSVWriter object.
Is there any specific reason for that?
+Pie Number of slices to send: Send
What do you mean by "Can not get flush method for CSVWriter object. "? If there is an error message, post it here along with the code that causes it.
+Pie Number of slices to send: Send
I mean
- In my eclipse IDE when i use intellisense(CTRL + Space) it does not show flush method for CSVWriter object but gives for Writer object.

that is my code.
+Pie Number of slices to send: Send
The important question is what happens during compilation - does that work?

If you want to know what methods a class has, check the javadocs; that's the ultimate reference, not what the IDE thinks.
+Pie Number of slices to send: Send
when i write this


compilation fails.
and says the method flush() is undefined for type CSVWriter.

+Pie Number of slices to send: Send
Try compiling on the command line, and make sure that the opencsv jar file you're using isn't corrupted - the javadocs say that the method exists.
+Pie Number of slices to send: Send
same error in the command line.
Compilation fails.
What is that issue?

compilation error in command line is::

cannot fine symbol
symbol: method flush()

 
+Pie Number of slices to send: Send
You should call flush and close on "reconWriter", not on "w".
+Pie Number of slices to send: Send
I tried it too .
But i am unable to find it compiled .
what can be the reason Ulf?
+Pie Number of slices to send: Send
 

But i am unable to find it compiled .


What does this mean? Does it or does it not compile?
+Pie Number of slices to send: Send
It did not compile.
+Pie Number of slices to send: Send
Then there would have been an error message that tells you what went wrong; tell us what that was. Also tell us what command you used to compile the code. (If you're still using an IDE, make sure you understand where that IDE would put compiled class files, and check whether that's where they are.)

And just to make sure: You have checked that the class file didn't end up in a different subdirectory than you expected, right? Packages are involved, after all.
+Pie Number of slices to send: Send
I did it in command prompt.
compilation error in command line is::

cannot fine symbol
symbol: method flush()




And in IDE the error message is::

flush() is undefined for type CSVWriter

 
+Pie Number of slices to send: Send
I just tried, and found that the following code compiles fine. It's the same you're using, minus any stuff that deals with classes that are not present; maybe you can work your way from there towards your code, and that way find out where the problem originates.
+Pie Number of slices to send: Send
ok fine!
and thanks for your help.!
I was born with webbed fish toes. This tiny ad is my only friend:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 15593 times.
Similar Threads
Exception in parse method of opencsv
Appending Date and TimeStamp to the File name
how to write comma in CSV file
Write comma with CSVWriter + help needed
ignoring comma in CSVWriter
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 06:58:13.