Package net.sf.jazzlib

Examples of net.sf.jazzlib.ZipEntry


    ZipInputStream oZip = new ZipInputStream(zipLeaf.getInputStream());
   
    try {
      // unzip files
      ZipEntry oEntr = oZip.getNextEntry();
      while (oEntr != null) {
        if (oEntr.getName() != null && !oEntr.getName().startsWith(DIR_NAME__MACOSX)) {
          if (oEntr.isDirectory()) {
            // skip MacOSX specific metadata directory
            // create directories
            getAllSubdirs(targetDir, oEntr.getName(), true);
          } else {
            // create file
            VFSContainer createIn = targetDir;
            String name = oEntr.getName();
            // check if entry has directories which did not show up as
            // directories above
            int dirSepIndex = name.lastIndexOf('/');
            if (dirSepIndex == -1) {
              // try it windows style, backslash is also valid format
              dirSepIndex = name.lastIndexOf('\\');
            }
            if (dirSepIndex > 0) {
              // create subdirs
              createIn = getAllSubdirs(targetDir, name.substring(0, dirSepIndex), true);
              if (createIn == null) {
                if (log.isDebug()) log.debug("Error creating directory structure for zip entry: "
                    + oEntr.getName());
                return false;
              }
              name = name.substring(dirSepIndex + 1);
            }
           
View Full Code Here


   
    ZipInputStream oZip = new ZipInputStream(zipLeaf.getInputStream());
   
    try {
      // unzip files
      ZipEntry oEntr = oZip.getNextEntry();
      while (oEntr != null) {
        if (oEntr.getName() != null && !oEntr.getName().startsWith(DIR_NAME__MACOSX)) {
          if (oEntr.isDirectory()) {
            // skip MacOSX specific metadata directory
            // directories aren't locked
            oZip.closeEntry();
            oEntr = oZip.getNextEntry();
            continue;
          } else {
            // search file
            VFSContainer createIn = targetDir;
            String name = oEntr.getName();
            // check if entry has directories which did not show up as
            // directories above
            int dirSepIndex = name.lastIndexOf('/');
            if (dirSepIndex == -1) {
              // try it windows style, backslash is also valid format
View Full Code Here

        for (Iterator<VFSItem> iter = items.iterator(); iter.hasNext();) {
          success = success && addToZip(iter.next(), itemName, out);
        }
      } else {
        // Add ZIP entry to output stream.
        out.putNextEntry(new ZipEntry(itemName));
 
        // Transfer bytes from the file to the ZIP file
        in = ((VFSLeaf)vfsItem).getInputStream();
        if (in != nullFileUtils.copy(in, out);
        // Complete the entry
View Full Code Here

    InputStream stream = null;
    ZipInputStream zip = null;
    try {
      stream = leaf.getInputStream();
      zip = new ZipInputStream(stream);
      ZipEntry entry = zip.getNextEntry();
      while (entry != null) {
        if (entry.getName().endsWith("content.xml")) {
          parse(new ShieldInputStream(zip), dh);
          break;//we parsed only content
        }
        entry = zip.getNextEntry();
      }
View Full Code Here

       
        String strAbsPath = sourceFile.getPath();
        String strZipEntryName = strAbsPath.substring(sourcePath.length(), strAbsPath.length());
       
        inputStream = new BufferedInputStream(new FileInputStream(sourceFile));
        ZipEntry zentry = new ZipEntry(strZipEntryName);
        zentry.setTime(sourceFile.lastModified());
        zipOutputStream.putNextEntry(zentry);

        int cnt = 0;
        while ((cnt = inputStream.read(buffer, 0, BUFFER_SIZE)) != -1) {
          zipOutputStream.write(buffer, 0, cnt);
View Full Code Here

       
    Resources result = new Resources();
        Enumeration<? extends ZipEntry> entries = zipFile.entries();

        while( entries.hasMoreElements() ) {
            ZipEntry zipEntry = entries.nextElement();

      if(zipEntry == null || zipEntry.isDirectory()) {
        continue;
      }
     
      String href = zipEntry.getName();
     
      Resource resource;
     
      if (shouldLoadLazy(href, lazyLoadedTypes)) {
        resource = new LazyResource(zipFile.getName(), zipEntry.getSize(), href);               
      } else {   
        resource = ResourceUtil.createResource(zipEntry, zipFile.getInputStream(zipEntry));
      }
     
      if(resource.getMediaType() == MediatypeService.XHTML) {
View Full Code Here

   * @return
   * @throws IOException
   */
  public static Resources loadResources(ZipInputStream zipInputStream, String defaultHtmlEncoding) throws IOException {
    Resources result = new Resources();
    ZipEntry zipEntry;
    do {
      // get next valid zipEntry
      zipEntry = getNextZipEntry(zipInputStream);
      if((zipEntry == null) || (zipEntry == ERROR_ZIP_ENTRY) || zipEntry.isDirectory()) {
        continue;
      }
     
      // store resource
      Resource resource = ResourceUtil.createResource(zipEntry, zipInputStream);
View Full Code Here

    return result;
  }

 
  private static ZipEntry getNextZipEntry(ZipInputStream zipInputStream) throws IOException {
    ZipEntry result = ERROR_ZIP_ENTRY;
    try {
      result = zipInputStream.getNextEntry();
    } catch(ZipException e) {
      LOG.error(e.getMessage());
      zipInputStream.closeEntry();
View Full Code Here

TOP

Related Classes of net.sf.jazzlib.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.