Package java.util.zip

Examples of java.util.zip.ZipOutputStream.finish()


                        oos.flush();
                        /**
                         * cause error oos.close();
                         */
                        zip.closeEntry();
                        zip.finish();
                        debug("Compressed caching " + ze.getCompressedSize() + " !");
                } catch (IOException ex) {
                        if (isDebugEnabled()) {
                                ex.printStackTrace();
                        }
View Full Code Here


        return false;
      }
      cpZipOutputStream = new ZipOutputStream(new FileOutputStream(target));
      cpZipOutputStream.setLevel(9);
      zipFiles(cpFile, sourcePath, cpZipOutputStream);
      cpZipOutputStream.finish();
      cpZipOutputStream.close();
    } catch (Exception e) { 
      e.printStackTrace();
      return false;
    }
View Full Code Here

        zout.setMethod(ZipOutputStream.DEFLATED);
        try {
            int pos = contentNode.getPath().length();
            exportZipEntry(context, zout, contentNode, pos > 1 ? pos+1 : pos);
        } finally {
            zout.finish();
        }
    }

    /**
     * If the specified node is the defined non-collection nodetype a new
View Full Code Here

        ZipOutputStream zout = new ZipOutputStream( bout );

        zout.putNextEntry( new ZipEntry( "repository_export.xml" ) );
        zout.write( dumpPackageFromRepositoryXml( packageName ) );
        zout.closeEntry();
        zout.finish();
        return bout.toByteArray();
    }

    public byte[] dumpPackageFromRepositoryXml(String packageName) throws PathNotFoundException,
                                                                  IOException,
View Full Code Here

        if (inPlaceConfUtil.isInPlaceConfiguration(dir)) {
            dir = inPlaceConfUtil.readInPlaceLocation(dir);
            writeToZip(dir, out, "", buf);
        }
        out.closeEntry();
        out.finish();
        out.flush();
    }

    private void writeToZip(File dir, ZipOutputStream out, String prefix, byte[] buf) throws IOException {
        File[] all = dir.listFiles();
View Full Code Here

                }
            } else {
                log.info("exclude "+name);
            }
        }
        out.finish();
        IOUtils.closeQuietly(out);
    }
    /**
     * @throws IOException
     *
 
View Full Code Here

        if (inPlaceConfUtil.isInPlaceConfiguration(dir)) {
            dir = inPlaceConfUtil.readInPlaceLocation(dir);
            writeToZip(dir, out, "", buf);
        }
        out.closeEntry();
        out.finish();
        out.flush();
    }

    private void writeToZip(File dir, ZipOutputStream out, String prefix, byte[] buf) throws IOException {
        File[] all = dir.listFiles();
View Full Code Here

            }
            fos = new FileOutputStream(target);
            cpZipOutputStream = new ZipOutputStream(fos);
            cpZipOutputStream.setLevel(9);
            zipFiles(cpFile, sourcePath, cpZipOutputStream);
            cpZipOutputStream.finish();
        }
        catch (Exception e)
        {
            logger.error("Unexpected exception during writing to zip output stream.", e);
            return false;
View Full Code Here

        zos.finish();
        assertEquals("Finish failed to closeCurrentEntry", 11, ze.getSize());

        ZipOutputStream zos = new ZipOutputStream(new ByteArrayOutputStream());
        zos.putNextEntry(new ZipEntry("myFile"));
        zos.finish();
        zos.close();
        try {
            zos.finish();
            fail("Assert 0: Expected IOException");
        } catch (IOException e) {
View Full Code Here

        ZipOutputStream zos = new ZipOutputStream(new ByteArrayOutputStream());
        zos.putNextEntry(new ZipEntry("myFile"));
        zos.finish();
        zos.close();
        try {
            zos.finish();
            fail("Assert 0: Expected IOException");
        } catch (IOException e) {
            // Expected
        }
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.