Package org.apache.commons.compress.archivers.zip

Examples of org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream.closeArchiveEntry()


            while (fis.read(b) > 0) {
                zos.write(b);
            }
            fis.close();
            fis = null;
            zos.closeArchiveEntry();
            zos.close();
            zos = null;
            zf = new ZipFile(archive);
            ZipArchiveEntry out = zf.getEntry("foo");
            assertNotNull(out);
View Full Code Here


            while (fis.read(b) > 0) {
                zos.write(b);
            }
            fis.close();
            fis = null;
            zos.closeArchiveEntry();
            zos.close();
            zos = null;
            zf = new ZipFile(archive);
            ZipArchiveEntry out = zf.getEntry("foo");
            assertNotNull(out);
View Full Code Here

            archive.deleteOnExit();
            zos = new ZipArchiveOutputStream(archive);
            long beforeArchiveWrite = tmp[0].lastModified();
            ZipArchiveEntry in = new ZipArchiveEntry(tmp[0], "foo");
            zos.putArchiveEntry(in);
            zos.closeArchiveEntry();
            zos.close();
            zos = null;
            zf = new ZipFile(archive);
            ZipArchiveEntry out = zf.getEntry("foo/");
            assertNotNull(out);
View Full Code Here

            zos = new ZipArchiveOutputStream(archive);
            long beforeArchiveWrite = tmp[0].lastModified();
            ZipArchiveEntry in = new ZipArchiveEntry("foo/");
            in.setTime(beforeArchiveWrite);
            zos.putArchiveEntry(in);
            zos.closeArchiveEntry();
            zos.close();
            zos = null;
            zf = new ZipFile(archive);
            ZipArchiveEntry out = zf.getEntry("foo/");
            assertNotNull(out);
View Full Code Here

            while (fis.read(b) > 0) {
                zos.write(b);
            }
            fis.close();
            fis = null;
            zos.closeArchiveEntry();
            zos.close();
            zos = null;
            zf = new ZipFile(archive);
            ZipArchiveEntry out = zf.getEntry("foo");
            assertNotNull(out);
View Full Code Here

            while (fis.read(b) > 0) {
                zos.write(b);
            }
            fis.close();
            fis = null;
            zos.closeArchiveEntry();
            zos.close();
            zos = null;
            zf = new ZipFile(archive);
            ZipArchiveEntry out = zf.getEntry("foo");
            assertNotNull(out);
View Full Code Here

        ZipArchiveEntry entry = new ZipArchiveEntry(entryName);
        zos.putArchiveEntry(entry);
        FileInputStream fis = new FileInputStream(fileName);
        IOUtils.copy(fis, zos);
        fis.close();
        zos.closeArchiveEntry();
      }
      zos.close();
      return new File(zipPath);
    } catch (Exception e) {
      throw new RuntimeException(e);
View Full Code Here

        pyEntry.setSize(pyBytes.length);
        pyEntry.setUnixMode(FileMode.EXECUTABLE_FILE.getBits());
        pyEntry.setTime(lastModified);
        zos.putArchiveEntry(pyEntry);
        zos.write(pyBytes);
        zos.closeArchiveEntry();

        // add a Python launch cmd file
        byte [] cmdBytes = readAll(getClass().getResourceAsStream("/pt.cmd"));
        ZipArchiveEntry cmdEntry = new ZipArchiveEntry("pt.cmd");
        cmdEntry.setSize(cmdBytes.length);
View Full Code Here

        cmdEntry.setSize(cmdBytes.length);
        cmdEntry.setUnixMode(FileMode.REGULAR_FILE.getBits());
        cmdEntry.setTime(lastModified);
        zos.putArchiveEntry(cmdEntry);
        zos.write(cmdBytes);
        zos.closeArchiveEntry();

        // add a brief readme
        byte [] txtBytes = readAll(getClass().getResourceAsStream("/pt.txt"));
        ZipArchiveEntry txtEntry = new ZipArchiveEntry("readme.txt");
        txtEntry.setSize(txtBytes.length);
View Full Code Here

        txtEntry.setSize(txtBytes.length);
        txtEntry.setUnixMode(FileMode.REGULAR_FILE.getBits());
        txtEntry.setTime(lastModified);
        zos.putArchiveEntry(txtEntry);
        zos.write(txtBytes);
        zos.closeArchiveEntry();

        // cleanup
        zos.finish();
        zos.close();
        os.flush();
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.