/** * Opens the zip file for random write access. * * @throws IOException if an error occured while opening the zip file for random read access. * @throws UnsupportedFileOperationException if a required operation is not supported by the underlying filesystem. */ private void openWrite() throws IOException, UnsupportedFileOperationException { if(raos!=null) { LOGGER.info("Warning: an existing RandomAccessOutputStream was found, closing it now"); raos.close(); } // Create a buffered output stream to improve write performance, as headers are written by small chunks raos = new BufferedRandomOutputStream(file.getRandomAccessOutputStream(), WRITE_BUFFER_SIZE); }
file.delete(); out = new BufferedRandomOutputStream(file.getRandomAccessOutputStream());