I'm trying to export a CSV file with the help of opencsv 3.7. I need to limit the size of my file and I didn't figure how to do it yet. file.size()
doesn't help in this situation.
Asked
Active
Viewed 186 times
-1

Brian Tompsett - 汤莱恩
- 5,753
- 72
- 57
- 129
1 Answers
1
You could implement a custom FileOutputStream
that counts bytes written by it's write()
method and close the stream if the maximum is reached.
Or you can ask the stream before writing the next csv-line to determine if there is still room.
Also take into account the file-encoding (do you want to count bytes, or characters?)

Rob Audenaerde
- 19,195
- 10
- 76
- 121
-
im very new to all of this, i want it to count bytes – Elior Edri May 18 '16 at 11:07