Skip to content
Advertisement

Write CSV file inside zip file using FileSystem

I want read the CSV files inside the zip file and edit the record based on some condition. I am using FileSystem class to create zip file system and then edit csv files. I used the below code read csv files

JavaScript

erro log =>

JavaScript

I wans able to read the and edit the files using inputStream from Path object and then pass it to CSVReader object. But when I pass outputStream to CSVWriter and try to write data to temp file and can’t see any changes inside zip file. And also I am getting a .tmp (zipfstmp3381860066025396844.tmp) file generated every I run my program.

I followed this => https://stackoverflow.com/a/43836969/20783127 to write this program

Don’t know what’s going wrong, I can anyone explain ?

I am trying read and edit the csv files in zip file using FileSystem class in java, but its not working

Advertisement

Answer

You did not zip.close(). Better use the try-with-resources syntax, which closes also when an exception is thrown or one returns inside the { }.

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement