Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

GZIPOutputStream skips last row when writing to file  RSS feed

 
malki sabag
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,
I have a .csv file that I want to compress, I am using the GZIPOutputStream. My issue is when trying to write to file it doesn't write the last row.
my code is like this:

the src file looks like this:
first line, first word
second line, first word, second word
third line, first word, second word, third word

in the new file created I only see the first two rows.
what am I missing??
thank you for your help.
 
Tony Docherty
Bartender
Posts: 3268
82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could try adding a print statement in while loop to print out the bytes you are reading to make sure you really are reading in what you think you are reading in.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!