Code example for ZipOutputStream

Methods: close, closeEntry, putNextEntry

     * @param zipFilePath The file name with path. 
     * @param suffix The file suffix. 
    private void createPartialTestPackageZip(String zipFilePath, String suffix)
                 throws IOException { 
        ZipOutputStream out = new ZipOutputStream(new FileOutputStream(
        String packageName = zipFilePath.substring(zipFilePath
                .lastIndexOf(File.separator), zipFilePath.lastIndexOf("."));
        String file = packageName + suffix;
        addFileToZip(file, out);
     * Add file to zip output stream. 
     * @param filename The file to be added to the zip output stream. 
     * @param out The zip output stream. 
    private void addFileToZip(String filename, ZipOutputStream out)
            throws IOException { 
        out.putNextEntry(new ZipEntry(filename));
     * Test listing package contents with different levels of expectation.