Package java.util.zip

Examples of java.util.zip.ZipEntry


    addHeader("Content-Disposition", "attachment; filename="+tsv_filename+".zip");
   
    ZipOutputStream zip_stream = new ZipOutputStream(getOutputStream());
    zip_stream.setLevel(9);
    zip_stream.setMethod(ZipOutputStream.DEFLATED);
    ZipEntry tsv_zip = new ZipEntry(tsv_filename);
    try
    {
      zip_stream.putNextEntry(tsv_zip);

      DownloadLogMessages log_messages = new DownloadLogMessages(zip_stream);
View Full Code Here


            byte buffer[] = new byte[10240];
            String path = file.getPath().substring(folderToArchive.getPath().length());
            path = path.replaceAll("\\\\", "/");
            if (path.length() > 0 && path.charAt(0) == '/')
                path = path.substring(1);
            ZipEntry entry = new ZipEntry(path);
            entry.setTime(file.lastModified());
            output.putNextEntry(entry);
            FileInputStream in = new FileInputStream(file);
            int data;
            while ((data = in.read(buffer, 0, buffer.length)) > 0)
                output.write(buffer, 0, data);
View Full Code Here

        boolean empty = true;

        try {
            zis = new ZipInputStream(jarStream);
            ZipEntry ent = null;

            while ((ent = zis.getNextEntry()) != null) {
                empty = false;

                String name = ent.getName();

                if (Manifest.isManifestName(name)) {
                    /* the object we're loading */
                    ByteArrayOutputStream baos = new ByteArrayOutputStream();
                    byte buffer[] = new byte[1024];
View Full Code Here

  public void unzip() throws Exception {
      if (zipFile == null || !zipFile.isFile())
          return;
      ZipFile zf = new ZipFile(zipFile);
      ZipEntry zipEntry;
      for (Enumeration zipEntries = zf.entries(); zipEntries.hasMoreElements(); saveEntry(
              zf.getInputStream(zipEntry), zipEntry))
          zipEntry = (ZipEntry) zipEntries.nextElement();

      zf.close();
View Full Code Here

      ZipFile zf = new ZipFile(zipFile);
      Enumeration zipEntries = zf.entries();
      do {
          if (!zipEntries.hasMoreElements())
              break;
          ZipEntry entry = (ZipEntry) zipEntries.nextElement();
          String entryName = entry.getName();
          if (TextUtils.stringSet(entryName) && entryName.startsWith("/"))
              entryName = entryName.substring(1);
          if (fileName.equals(entryName)) {
              fileFound = true;
              result = saveEntry(zf.getInputStream(entry), entry);
View Full Code Here

    }

    private void backupPageStore(ZipOutputStream out, String fileName, PageStore store) throws IOException {
        Database db = session.getDatabase();
        fileName = IOUtils.getFileName(fileName);
        out.putNextEntry(new ZipEntry(fileName));
        int max = store.getPageCount();
        int pos = 0;
        while (true) {
            pos = store.copyDirect(pos, out);
            if (pos < 0) {
View Full Code Here

        if (!f.startsWith(base)) {
            DbException.throwInternalError(f + " does not start with " + base);
        }
        f = f.substring(base.length());
        f = correctFileName(f);
        out.putNextEntry(new ZipEntry(f));
        InputStream in = IOUtils.openFileInputStream(fn);
        IOUtils.copyAndCloseInput(in, out);
        out.closeEntry();
    }
View Full Code Here

  public static final int BUFFER = 4096;
  public static void speedupZip(InputStream input, OutputStream output)
    throws IOException {
    ZipInputStream in = new ZipInputStream(input);
    ZipOutputStream out = new ZipOutputStream(output);
    ZipEntry inentry;
    ZipEntry outentry;
    int count;
    byte[] buffer = new byte[BUFFER];
    while ((inentry = in.getNextEntry()) != null) {
      outentry = new ZipEntry(inentry.getName());
      logger.debug("Extra: " + inentry.getExtra());
      outentry.setExtra(inentry.getExtra());
      logger.debug("time: " + inentry.getTime());
      outentry.setTime(inentry.getTime());
      logger.debug("method: " + inentry.getMethod());
      outentry.setMethod(inentry.getMethod());
      logger.debug("comment: " + inentry.getComment());
      outentry.setComment(inentry.getComment());
      logger.debug("CRC: " + inentry.getCrc());
      if (inentry.getCrc() != -1) {
        outentry.setCrc(inentry.getCrc());
      }
      logger.debug("size: " + inentry.getSize());
      if (inentry.getSize() != -1) {
        outentry.setSize(inentry.getSize());
      }
      out.putNextEntry(outentry);
      if (!inentry.isDirectory()) {
        if (inentry.getName().endsWith(".jar")
          || inentry.getName().endsWith(".zip")
View Full Code Here

          
      UpdateInstaller installer = checker.createInstaller();
     
      zip = new ZipInputStream(data);
     
      ZipEntry entry = null;
     
      while((entry = zip.getNextEntry()) != null) {
       
        String name = entry.getName();
       
          // all jars
       
        if ( name.endsWith( ".jar" )){
         
View Full Code Here

      } catch (FileNotFoundException e) {
        continue;
      }

      try {
        ZipEntry entry = new ZipEntry(file.getName());
        entry.setTime(file.lastModified());
        out.putNextEntry(entry);
        //  Transfer bytes from the file to the ZIP file
        int len;
        while ((len = in.read(buf)) > 0) {
          out.write(buf, 0, len);
View Full Code Here

TOP

Related Classes of java.util.zip.ZipEntry

Copyright © 2018 www.massapicom. 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.