Package java.util.zip

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


            for ( IBrowserConnection browserConnection : browserConnections )
            {
                browserConnectionsMap.put( browserConnection.getConnection().getId(), browserConnection );
            }
            BrowserConnectionIO.save( zos, browserConnectionsMap );
            zos.closeEntry();
            // Closing the ZipOutputStream
            zos.close();
        }
        catch ( FileNotFoundException e )
        {
View Full Code Here


            ZipEntry entry = new ZipEntry("repository.xml");
            jos.putNextEntry(entry);
            PrintWriter pw = new PrintWriter(new OutputStreamWriter(jos, "UTF-8"));
            this.printRepositoryXML(pw, "", selectedBundles);
            pw.flush();
            jos.closeEntry();

            for (Iterator ri = this.repository.getResourcesById(); ri.hasNext();) {
                Resource res = (Resource) ri.next();

                // spool the resource out if selected or global dump
View Full Code Here

                if (selectedBundles == null
                        || selectedBundles.contains(resourceName)) {
                    entry = new ZipEntry(resourceName);
                    jos.putNextEntry(entry);
                    res.spool(jos);
                    jos.closeEntry();
                }
            }

        } finally {
            IOUtils.closeQuietly(jos);
View Full Code Here

    public static File createZipFileInTemporaryFolder(File targetFolder, String name, File content) throws IOException {
        File file = new File(targetFolder, name);
        ZipOutputStream zipOutputStream = new ZipOutputStream(new FileOutputStream(file));
        zipOutputStream.putNextEntry(new ZipEntry(content.getName()));
        zipOutputStream.write(FileUtils.readFileToByteArray(content));
        zipOutputStream.closeEntry();
        zipOutputStream.close();
        file.deleteOnExit();
        return file;
    }
}
View Full Code Here

        int size;
        byte[] buffer = new byte[BUFFER_SIZE];
        while ((size = in.read(buffer, 0, buffer.length)) > 0) {
            zos.write(buffer, 0, size);
        }
        zos.closeEntry();
        zos.close();
        in.close();
        contents = baos.toByteArray();
    }
View Full Code Here

                    FileInputStream in = new FileInputStream(file);
                    StreamUtils.transfer(in, zipOut);
                    in.close();

                    zipOut.closeEntry();
                    zipOut.close();

                    emailContent.addAttachment(new EmailAttachment.FileAttachment(name + ".zip", zipFile));

                    filesToDelete.add(zipFile);
View Full Code Here

      for (ContainerElement ph : containerItems) {
        ze = new ZipEntry(ph.targetInArchive);
        ze.setTime(0);
        zos.putNextEntry(ze);
        BucketTools.copyTo(ph.data, zos, ph.data.size());
        zos.closeEntry();
      }
    } finally {
      zos.close();
    }
View Full Code Here

              name = name.endsWith("/") ? name : name + "/";
              zout.putNextEntry(new ZipEntry(name));
            } else {
              zout.putNextEntry(new ZipEntry(name));
              copy(kid, zout);
              zout.closeEntry();
            }
          }
        }
      } finally {
        res.close();
View Full Code Here

 
          // Transfer bytes from the file to the ZIP file
          IOUtils.copyLarge(in, out);
         
          // Complete the entry
          out.closeEntry();
          IOUtils.closeQuietly(in);
        }
      }

      // Complete the ZIP file
View Full Code Here

                out.putNextEntry(destination);
                try {
                    FileUtils.copy(source, out);
                    destination.setTime(source.lastModified());
                } finally {
                    out.closeEntry();
                }
            }
            return into.getPath();
        } finally {
            out.close();
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.