Package java.util.jar

Examples of java.util.jar.JarEntry


        // Add all bundles in the current language
        for (String bundleName : I18nModule.getBundleNamesContainingI18nFiles()) {
          Properties propertyFile = getPropertiesWithoutResolvingRecursively(locale, bundleName);
          String entryFileName = bundleName.replace(".", "/") + "/" + I18N_DIRNAME + "/" + buildI18nFilename(locale);
          // Create jar entry for this path, name and last modified
          JarEntry jarEntry = new JarEntry(entryFileName);
          jarEntry.setTime(now);
          // Write properties to jar file
          out.putNextEntry(jarEntry);
          propertyFile.store(out, null);
          if (isLogDebugEnabled()) {
            logDebug("Adding file::" + entryFileName + " + to jar", null);
View Full Code Here


      else jos = new JarOutputStream(fos);

      // process all modules
      TargetModuleInfo moduleInfo = new TargetModuleInfo();
      ModuleType moduleType = null;
      JarEntry entry = jis.getNextJarEntry();
      while (entry != null)
      {
         String entryName = entry.getName();

         // only process file entries
         if (entryName.endsWith("/") == false)
         {
            moduleType = ifNotNull(determineModuleType(entryName), moduleType);
View Full Code Here

      if (manifest != null)
         jos = new JarOutputStream(fos, manifest);
      else jos = new JarOutputStream(fos);

      // now copy entry by entry
      JarEntry entry = jisModule.getNextJarEntry();
      while (entry != null)
      {
         String subEntryName = entry.getName();
         if (mapDeploymentPlan.get(entryName + "!/" + subEntryName) == null)
            JarUtils.addJarEntry(jos, subEntryName, jisModule);
         else log.debug("Skip entry found in deployment plan: " + subEntryName);

         entry = jisModule.getNextJarEntry();
View Full Code Here

      // process the deployment plan
      try
      {
         JarInputStream jarDeploymentPlan = new JarInputStream(deploymentPlan);
         JarEntry entry = jarDeploymentPlan.getNextJarEntry();
         while (entry != null)
         {
            String entryName = entry.getName();
            log.debug("unpack deployment plan entry: " + entryName);

            File tempFile = getTempFile(entryName);
            dpMap.put(entryName, tempFile);
View Full Code Here

      String jarName = jar.getFile();
      JarFile jf = new JarFile(jarName);
      Enumeration entries = jf.entries();
      while( entries.hasMoreElements() )
      {
         JarEntry entry = (JarEntry) entries.nextElement();
         String name = entry.getName();
         if( name.endsWith(".class") && name.startsWith(pkgPrefix) )
         {
            name = name.substring(0, name.length() - 6);
            String classname = name.replace('/', '.');
            try
View Full Code Here

          jar = new JarFile(file);
          Enumeration<JarEntry> jarEntries = jar.entries();
          // Check in all jars - maybe we have context help files in
          // jar resources
          while (jarEntries.hasMoreElements()) {
            JarEntry jarEntry = jarEntries.nextElement();
            String jarEntryName = jarEntry.getName();
            // TODO:FG: check for \\ instead of / for windows, rare case
            if (jarEntryName.indexOf("/" + CHELP_DIR + "/") != -1) {
              if (!jarEntry.isDirectory()) {
                // Add file from jar to help page list
                // extract class name without trailing slashes
                int staticDirPos = jarEntryName.indexOf(CHELP_DIR);
                String packageName = jarEntryName.substring(0, staticDirPos - 1);
                packageName = packageName.replace("/", ".");
View Full Code Here

            FileOutputStream fos = new FileOutputStream(file);
            JarOutputStream jos = new JarOutputStream(fos, mf);
            Enumeration entries = jarFile.entries();
            while( entries.hasMoreElements() )
            {
               JarEntry entry = (JarEntry) entries.nextElement();
               String name = entry.getName();
               if( name.equals("META-INF/MANIFEST.MF") )
               {
                  continue;
               }

               JarEntry outEntry = new JarEntry(entry.getName());
               outEntry.setTime(entry.getTime());
               if( entry.getComment() != null )
                  outEntry.setComment(entry.getComment());
               jos.putNextEntry(outEntry);
               InputStream is = jarFile.getInputStream(entry);
               int bytes = is.read(buffer);
               while( bytes > 0 )
               {
View Full Code Here

         is = getFile().openStream();
         if (is instanceof JarInputStream)
         {
            JarInputStream jis = (JarInputStream)is;
            JarOutputStream os = new JarOutputStream(bos);
            JarEntry je = null;
            while ((je = jis.getNextJarEntry()) != null)
            {
               if (filter != null && filter.accept(je.getName()))
               {
                  os.putNextEntry(je);
                  VFSUtils.copyStream(jis, os);
               }
            }
View Full Code Here

    InputStream classInputStream = null;
    if (this.extensionJars != null) {
      // Check if searched class is an extension class
      for (int i = 0; i < this.extensionJars.length; i++) {
        JarFile extensionJar = this.extensionJars [i];
        JarEntry jarEntry = extensionJar.getJarEntry(classFile);
        if (jarEntry != null) {
          try {
            classInputStream = extensionJar.getInputStream(jarEntry);
          } catch (IOException ex) {
            throw new ClassNotFoundException("Couldn't read class " + name, ex);
View Full Code Here

  protected URL findResource(String name) {
    if (this.extensionJars != null) {
      // Try to find if resource belongs to one of the extracted jars
      for (int i = 0; i < this.extensionJars.length; i++) {
        JarFile extensionJar = this.extensionJars [i];
        JarEntry jarEntry = extensionJar.getJarEntry(name);
        if (jarEntry != null) {
          try {
            return new URL("jar:file:" + extensionJar.getName() + ":" + jarEntry.getName());
          } catch (MalformedURLException ex) {
            // Forget that we could have found a resource
          }
        }
      }
View Full Code Here

TOP

Related Classes of java.util.jar.JarEntry

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.