Examples of ZipEntry


Examples of java.util.zip.ZipEntry

    File rarFile = new File(rarName);
    if (rarFile.exists()) {
      ZipFile zipFile = new ZipFile(rarFile.getAbsolutePath());
      for (Enumeration zippedFiles = zipFile.entries(); zippedFiles.hasMoreElements(); ) {
        // Retrieve entry of existing files
        ZipEntry currEntry = (ZipEntry) zippedFiles.nextElement();
        if (debug)
          System.out.println("RAConfig.updateRAR : currEntry = " + currEntry);
        if (currEntry.getName().equalsIgnoreCase(RA_XML)) {
          InputStream reader = zipFile.getInputStream(currEntry);
          createFile("ra.xml",update(reader,map));
          reader.close();
          break;
        }
View Full Code Here

Examples of java.util.zip.ZipEntry

                         "\", path \"" + path +
                         "\", new file \"" + newFileName +
                         "\", old file \"" + oldFileName + "\"");


    ZipEntry entry = null;

    File file = new File(zipName);
    if (file.exists()) {
      ZipFile zipFile = new ZipFile(file.getAbsolutePath());
      Enumeration zipEntries = zipFile.entries();
      // create your output zip file
      ZipOutputStream newZip = new ZipOutputStream(
        new FileOutputStream(new File(file.getAbsolutePath() + "_TMP")));

      // Get all data (except the oldFileName) from zip file and
      // write it to the tmp zip file
      while (zipEntries.hasMoreElements()) {
        entry = (ZipEntry) zipEntries.nextElement();
        if (entry.getName().equalsIgnoreCase(oldFileName))
          continue;
        newZip.putNextEntry(new ZipEntry(entry.getName()));
        InputStream is = zipFile.getInputStream(entry);
        try {
          dump(is,newZip);
        } finally {
          newZip.closeEntry();
          is.close();
        }
      }
      zipFile.close();

      // Write the new fileName to the zip
      entry = new ZipEntry(path);
      newZip.putNextEntry(entry);
      try {
        FileInputStream fis = new FileInputStream(newFileName);
        dump(fis,newZip);
        fis.close();
View Full Code Here

Examples of java.util.zip.ZipEntry

    try {
      byte[] c = new byte[1024];
      int slen;
      zip_in = new CZipInputStream(new FileInputStream(zipPath),"utf-8");
      do {
        ZipEntry file = zip_in.getNextEntry();
        if (file == null)
          break;
       
        // ��ѹ���ŵ�·��
        String fileName = file.getName();
        System.out.println(fileName);
       
        String ext = fileName.substring(fileName.lastIndexOf("."));

        long seed = new Date(System.currentTimeMillis()).getTime();
View Full Code Here

Examples of java.util.zip.ZipEntry

                catch (Exception e) {
                    Plugin.getDefault().logError("Unable to find source for wga version compliance '" + wgaVersion.getMajorVersion() + "." + wgaVersion.getMinorVersion() + "'.");
                    return null;
                }               
                zipIn = new ZipInputStream(sourceIn);
                ZipEntry entry = zipIn.getNextEntry();
                while (entry != null) {
                    String sourceName = entry.getName();
                    sourceName = sourceName.replaceAll("/", ".");
                    if (sourceName.endsWith(".java")) {
                        sourceName = sourceName.substring(0, sourceName.length() - ".java".length());
                    }
                    if (sourceName.equals(classname)) {
View Full Code Here

Examples of java.util.zip.ZipEntry

      // Open the ZIP file
      JarFile zf = new JarFile(getBase());

      // Enumerate each entry
      for (Enumeration<JarEntry> entries = zf.entries(); entries.hasMoreElements();) {
        ZipEntry entry = entries.nextElement();
        mZipFileEntries.put(entry.getName(), entry);
      }
    } catch (IOException e) {
      // If something goes wrong, reset Theme
      mZipFileEntries = new HashMap<String, ZipEntry>();
    }
View Full Code Here

Examples of java.util.zip.ZipEntry

   *
   * @param entry File/Entry to load
   * @return InputStream of specific Entry
   */
  protected InputStream getInputStream(String entry) {
    ZipEntry zipEntry = mZipFileEntries.get(entry);
    try {
      return new JarFile(getBase()).getInputStream(zipEntry);
    } catch (IOException e) {
      e.printStackTrace();
    }
View Full Code Here

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

Examples of org.apache.tools.zip.ZipEntry

                // The iteration order of zip.getEntries() is based on the hash of the zip entry. This isn't much use
                // to us. So, collect the entries in a map and iterate over them in alphabetical order.
                Map<String, ZipEntry> entriesByName = new TreeMap<String, ZipEntry>();
                Enumeration entries = zip.getEntries();
                while (entries.hasMoreElements()) {
                    ZipEntry entry = (ZipEntry) entries.nextElement();
                    entriesByName.put(entry.getName(), entry);
                }
                Iterator<ZipEntry> sortedEntries = entriesByName.values().iterator();
                while (!stopFlag.get() && sortedEntries.hasNext()) {
                    ZipEntry entry = sortedEntries.next();
                    if (entry.isDirectory()) {
                        visitor.visitDir(new DetailsImpl(entry, zip, stopFlag));
                    } else {
                        visitor.visitFile(new DetailsImpl(entry, zip, stopFlag));
                    }
                }
View Full Code Here

Examples of org.beangle.commons.archiver.zip.ZipEntry

    try {
      zf = new ZipFile(zipFile);
      @SuppressWarnings("unchecked")
      Enumeration<ZipEntry> enu = zf.getEntries();
      while (enu.hasMoreElements()) {
        ZipEntry entry = (ZipEntry) enu.nextElement();
        String name = entry.getName();
        String path = dest + name;
        File file = new File(path);
        if (entry.isDirectory()) {
          file.mkdirs();
        } else {
          InputStream is = zf.getInputStream(entry);
          byte[] buf1 = new byte[1024];
          int len;
View Full Code Here

Examples of org.codehaus.plexus.archiver.zip.ZipEntry

            zf = new ZipFile( file, "utf-8" );
            Enumeration entries = zf.getEntries();
            HashSet dirSet = new HashSet();
            while ( entries.hasMoreElements() )
            {
                ZipEntry ze =
                    (ZipEntry) entries.nextElement();
                String name = ze.getName();
                // META-INF would be skipped anyway, avoid index for
                // manifest-only jars.
                if ( !name.startsWith( "META-INF/" ) )
                {
                    if ( ze.isDirectory() )
                    {
                        dirSet.add( name );
                    }
                    else if ( name.indexOf( "/" ) == -1 )
                    {
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.