private void zip() {
		File curFile;
		String curFilename;
		ZipEntry curEntry;
		FileInputStream curInput;
		ZipOutputStream zipOutput = new ZipOutputStream(outFile);
		
		while (filesIndex < filesToWrite.length && !suspending) {
			curFilename = filesToWrite[filesIndex];
			curFile = new File(curFilename);
			//If the current file doesn't exist, simply let the user know and continue.
			if (!curFile.exists() || curFile.isDirectory()) {
				System.out.println("File " + curFilename + " does not exist. Continuing...");
				filesIndex += 1;
				continue;
			}
			//If we get here, the current file exists and can thus be compressed.
			curEntry = new ZipEntry(curFilename);
			try {
				zipOutput.putNextEntry(curEntry);
				curInput = new FileInputStream(curFilename);
				byte[] buffer = new byte[1024];
				int len;
				// Note that we don't need transactional writing because the process can never
				// be migrated at this stage.
	    		while ((len = curInput.read(buffer)) > 0) {
	    			zipOutput.write(buffer, 0, len);
	    		}
	 
	    		curInput.close();
	    		zipOutput.closeEntry();
			} catch (IOException e) {
				System.out.println("The zip must have at least one valid file to compress.");
			}
			filesIndex += 1;	
		}
		//After all the files are written, close the zip output stream.
		if (!suspending && filesIndex == filesToWrite.length) {
			try {
				zipOutput.close();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		suspending = false;
	}