title: Java Error while opening a large file of 2.2GB in appending mode which is inside a zipfile using java7 NIO
body: <p>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.</p>
  
  <pre><code>java.lang.IllegalArgumentException: Negative initial size: -2030790440
      at java.io.ByteArrayOutputStream.&lt;init&gt;(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 
  </code></pre>
  
  <p>Here is the code snippet I'm using. <br>
  code line : <br></p>
  
  <pre><code>filePath = "/tmp/tmp.zip";
  Path path = Paths.get(filePath);
  URI uri = URI.create("jar:" + path.toUri());
  fs =  FileSystems.newFileSystem(uri, env);
  Path nf = fs.getPath("detailedreport.csv");
  Writer writer = Files.newBufferedWriter(nf, StandardCharsets.UTF_8, StandardOpenOption.APPEND);
  </code></pre>
  
  <p><strong>note</strong> :<br>
  file already exists <br>
  It seems like BufferWriter's int max limit is reached while reading the size of the file hence the exception.</p>