Package net.sf.jazzlib

Examples of net.sf.jazzlib.ZipOutputStream


      String name = target.getName();
      if (target instanceof LocalImpl)
        name = ((LocalImpl)target).getBasefile().getAbsolutePath();
      throw new OLATRuntimeException(ZipUtil.class, "Error getting output stream for file: " + name, null);
    }
    ZipOutputStream zipOut = new ZipOutputStream(out);
    for (Iterator<VFSItem> iter = vfsFiles.iterator(); iter.hasNext();) {
      success = success && addToZip(iter.next(), "", zipOut);
    }
    FileUtils.closeSafely(zipOut);
    return success;
View Full Code Here


    targetDir = targetDir.replace("\\", String.valueOf(File.separatorChar));
    targetDir = targetDir.replace("/", String.valueOf(File.separatorChar));
    targetDir += FS;

    BufferedOutputStream outputStream = null;
    ZipOutputStream zipOutputStream = null;
    try {
      outputStream = new BufferedOutputStream(new FileOutputStream(targetDir + FS + fileNm));
      zipOutputStream = new ZipOutputStream(outputStream);
      zipOutputStream.setLevel(COMPRESSION_LEVEL);

      zipEntry(sourceFile, sourcePath, targetDir, zipOutputStream);
     
      if (ua != null) {
        zipOutputStream.putNextEntry(new net.sf.jazzlib.ZipEntry("META-INF" + File.separatorChar));
        zipOutputStream.closeEntry();
       
        zipOutputStream.putNextEntry(new net.sf.jazzlib.ZipEntry("META-INF" + File.separatorChar+ "manifest.xml"));
        try {
          GlobalContext.serialize(ua, zipOutputStream, String.class);
          zipOutputStream.closeEntry();
        } catch (Exception e) {
          //e.printStackTrace();
        }
      }
     
     
      zipOutputStream.finish();
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      if (zipOutputStream != null) {
        zipOutputStream.close();
      }
      if (outputStream != null) {
        outputStream.close();
      }
    }
View Full Code Here

      System.out.println("You gave a non-zip file name... please check your parameters...");
      return;
    }

    BufferedOutputStream outputStream = null;
    ZipOutputStream zipOutputStream = null;
    try {
      outputStream = new BufferedOutputStream(new FileOutputStream(targetDirPath + FS + fileNm));
      zipOutputStream = new ZipOutputStream(outputStream);
      zipOutputStream.setLevel(COMPRESSION_LEVEL);

      for (int i = 0; i < fileLists.size(); i++) {
        int indexNum = ((File) fileLists.get(i)).getAbsolutePath().lastIndexOf(FS);
        System.out.println("indexNum ::: " + indexNum);
        String sourcePath = ((File) fileLists.get(i)).getAbsolutePath().substring(0, indexNum);
        System.out.println("sourcePath :::: " + sourcePath);
        zipEntry((File) fileLists.get(i), sourcePath, targetDirPath, zipOutputStream);
      }
      zipOutputStream.finish();
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      if (zipOutputStream != null) {
        zipOutputStream.close();
      }
      if (outputStream != null) {
        outputStream.close();
      }
    }
View Full Code Here

TOP

Related Classes of net.sf.jazzlib.ZipOutputStream

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.