Package de.schlichtherle.util.zip

Examples of de.schlichtherle.util.zip.ZipEntry


      File doc = new File(p);
      if(doc.exists()) { //file case
          ZipUtil.copyArchiveContent(pInArchive, destinationFolder,  doc.getAbsolutePath(), zop);
        } else { //url case
            try {
                ZipEntry zipEntryOut = new ZipEntry(destinationFolder+"/"+Parameters.FORWARD_FILE_NAME); //$NON-NLS-1$
                zop.putNextEntry(zipEntryOut);
                zop.write(p.getBytes());
                zop.closeEntry();
            } catch (Exception e) {
                e.printStackTrace();
View Full Code Here


      byte[] bytes = content.getBytes();
        writeContent(name, bytes, zop);
    }

  private void writeContent(String name, byte[] bytes, ZipOutputStream zop) throws IOException {
    ZipEntry zipEntry = new ZipEntry(name);
        zop.putNextEntry(zipEntry);
    zop.write(bytes);
        zop.closeEntry();
  }
View Full Code Here

        try {
            // count the zip entries so we can do progress bar
            long totalSize = 0L;
            for (Enumeration<? extends ZipEntry> it = zip.entries(); it
                    .hasMoreElements();) {
                ZipEntry e = it.nextElement();
                totalSize += e.getSize();
            }

            long bytesSoFar = 0L;
            for (Enumeration<? extends ZipEntry> it = zip.entries(); it
                    .hasMoreElements();) {
                ZipEntry entry = it.nextElement();
               
                // zip entries can be created on windows or unix, and can retain
                // the path separator for that platform.  We must ensure that
                // the paths we find inside the zip file will work on the platform
                // we are running on.  Technically, zip entry paths should be
                // created using the unix separator, no matter what platform they
                // are created on - but this is not always done correctly.
                final String entryName = getPlatformSpecificPath(entry.getName());
               
                File expandedFile = new File(destination + File.separator
                        + entryName);

                BufferedInputStream in = new BufferedInputStream(zip
View Full Code Here

            String entryPath = getUnixStylePath(StringUtils.substringAfter(file
                    .getAbsolutePath(), sourcePath));

            //ZipArchiveEntry entry = (ZipArchiveEntry) out.createArchiveEntry(file, entryPath);
            //out.putArchiveEntry(entry);
            ZipEntry entry = new ZipEntry(entryPath);
            out.putNextEntry(entry);

            final BufferedInputStream in = new BufferedInputStream(new FileInputStream(file));
            try {
                bytesProcessed = writeFile(in, out, callback, bytesProcessed, bytesToProcess);
View Full Code Here

            }

            // Add any that haven't yet been processed (from shortest to longest)
            for (int pathIndex = longestSeenBefore - 1; pathIndex >= 0; pathIndex--) {
                final String pathName = paths.get(pathIndex);
                ZipEntry entry = new ZipEntry(pathName);
                String dirName = FilenameUtils.getName(pathName.substring(0, pathName.length() - 1));
                longestParentId = submitDirectory(parentName, entry, dirName, longestParentId);
                directories.put(pathName, longestParentId);
            }
           
View Full Code Here

    public void process(IdentificationRequest request, ContainerSignatureMatchCollection matches) throws IOException {
        BasicZipFile zipFile = new BasicZipFile(request.getSourceFile());
        try {
            // For each entry:
            for (String entryName : matches.getAllFileEntries()) {
                final ZipEntry entry = zipFile.getEntry(entryName);
                if (entry != null) {
                    // Get a stream for the entry and a byte reader over the stream:
                    InputStream stream = zipFile.getInputStream(entry);
                    ByteReader reader = null;
                    try {
View Full Code Here

                    if (stream instanceof LazyFileInputStream) {
                        stream = ((LazyFileInputStream) stream).getInputSteam();// 获取原始的stream
                    }

                    exist = true;
                    zipOut.putNextEntry(new ZipEntry(input.getName()));
                    NioUtils.copy(stream, zipOut);// 输出到压缩流中
                    zipOut.closeEntry();
                } finally {
                    IOUtils.closeQuietly(stream);
                }
View Full Code Here

            zipFile = new ZipFile(archiveFile);
            Enumeration entries = zipFile.entries();

            while (entries.hasMoreElements()) {
                // entry
                ZipEntry entry = (ZipEntry) entries.nextElement();
                String entryName = entry.getName();
                // target
                File targetFile = new File(targetDir, entryName);
                NioUtils.create(targetFile.getParentFile(), false, 3);// 尝试创建父路径
                InputStream input = null;
                OutputStream output = null;
View Full Code Here

TOP

Related Classes of de.schlichtherle.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.