While I'm trying to open a csv file of 2.2GB in append mode which is in a zip file whose size is 144MB, I get the following exception.
java.lang.IllegalArgumentException: Negative initial size: -2030790440
at java.io.ByteArrayOutputStream.<init>(ByteArrayOutputStream.java:74)
at com.sun.nio.zipfs.ZipFileSystem.getOutputStream(ZipFileSystem.java:1371)
at com.sun.nio.zipfs.ZipFileSystem.newOutputStream(ZipFileSystem.java:516)
at com.sun.nio.zipfs.ZipPath.newOutputStream(ZipPath.java:792)
at com.sun.nio.zipfs.ZipFileSystemProvider.newOutputStream(ZipFileSystemProvider.java:285)
at java.nio.file.Files.newOutputStream(Files.java:170)
at java.nio.file.Files.newBufferedWriter(Files.java:2705)
at
Here is the code snippet I'm using :
note :
file already exists
It seems like BufferWriter's int max limit is reached while reading the size of the file hence the exception.