Package java.util.jar

Examples of java.util.jar.JarOutputStream.closeEntry()


    for (Map.Entry<String,byte[]> e : repo.entrySet()) {
        String classFilename = e.getKey() + ".class";
        byte[] classContents = e.getValue();
        jo.putNextEntry(new ZipEntry(classFilename));
        jo.write(classContents);
        jo.closeEntry();
    }
    jo.close();
    tmpFile.renameTo(file);
      } catch (IOException ioe) {
        log.warning("Warning: Failed to store cached module in "+file);
View Full Code Here


            byte InputData[] = new byte[BUFFER];
            while ((len = is.read(InputData)) != EOF)
            {
               jos.write(InputData, 0, len);
            }
            jos.closeEntry();
         }
         else if (di instanceof FileDataInstance)
         {
            di.getJarOut(true, jos);
         }
View Full Code Here

            byte InputData[] = new byte[BUFFER];
            while ((len = is.read(InputData)) != EOF)
            {
               jos.write(InputData, 0, len);
            }
            jos.closeEntry();
            is.close();
         }
         else if (di instanceof FileDataInstance)
         {
            di.setType("Jar");
View Full Code Here

        File result = File.createTempFile("Generated", ".jar", dexCache);
        result.deleteOnExit();
        JarOutputStream jarOut = new JarOutputStream(new FileOutputStream(result));
        jarOut.putNextEntry(new JarEntry(DexFormat.DEX_IN_JAR_NAME));
        jarOut.write(dex);
        jarOut.closeEntry();
        jarOut.close();
        try {
            return (ClassLoader) Class.forName("dalvik.system.DexClassLoader")
                    .getConstructor(String.class, String.class, String.class, ClassLoader.class)
                    .newInstance(result.getPath(), dexCache.getAbsolutePath(), null, parent);
View Full Code Here

      je.setSize(contents.length());
      je.setTime(System.currentTimeMillis()+1);
      je.setMethod(JarEntry.DEFLATED);
      jos.putNextEntry(je);
      jos.write(contents.toString().getBytes());
      jos.closeEntry();
      jos.close();
      fos.close();
      assertTrue(tmpJar.exists());
      return tmpJar;
   }
View Full Code Here

         ZipEntry entry = new ZipEntry("META-INF/some.txt");
         entry.setComment("some_comment");
         entry.setExtra("qwerty".getBytes());
         entry.setSize(1);
         jos.putNextEntry(entry);
         jos.closeEntry();

         entry = new ZipEntry("META-INF/other.txt");
         entry.setComment("other_comment");
         entry.setExtra("foobar".getBytes());
         entry.setSize(1);
View Full Code Here

         entry = new ZipEntry("META-INF/other.txt");
         entry.setComment("other_comment");
         entry.setExtra("foobar".getBytes());
         entry.setSize(1);
         jos.putNextEntry(entry);
         jos.closeEntry();
      }
      finally
      {
         jos.close();
      }
View Full Code Here

                while (bytes != -1) {
                    output.write(buffer, 0, bytes);
                    bytes = fis.read(buffer);
                }
                fis.close();
                output.closeEntry();
                fis = null;
            }
        }
        finally {
          if (fis != null) {
View Full Code Here

                attrs.putValue("Bundle-Localization", "locale");
                JarOutputStream jos = new JarOutputStream(baos, manifest);
                jos.putNextEntry(new ZipEntry("locale.properties"));
                String content = "bundleName=The Coolest Bundle";
                jos.write(content.getBytes(), 0, content.getBytes().length);
                jos.closeEntry();
                jos.close();

                // if you want to validate that the bundle is okay
                // FileOutputStream fos = new FileOutputStream(new File("/Users/marceloffermans/unittest.jar"));
                // fos.write(baos.toByteArray(), 0, baos.size());
View Full Code Here

                attrs.putValue("Bundle-Name", "%bundleName");
                JarOutputStream jos = new JarOutputStream(baos, manifest);
                jos.putNextEntry(new ZipEntry(Constants.BUNDLE_LOCALIZATION_DEFAULT_BASENAME + ".properties"));
                String content = "bundleName=The Coolest Bundle";
                jos.write(content.getBytes(), 0, content.getBytes().length);
                jos.closeEntry();
                jos.close();
                return new ByteArrayInputStream(baos.toByteArray());
            }

            @Override
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.