Examples of JarOutputStream


Examples of java.util.jar.JarOutputStream

    {
        Manifest newManifest = updateHeaders();
        String origName = getName();
       
        File newJar = new File(origName + ".new.jar");
        JarOutputStream jos = new JarOutputStream(new FileOutputStream(newJar), newManifest);
       
        Enumeration en = jarFile.entries();
        while (en.hasMoreElements())
        {
            ZipEntry ze = (ZipEntry) en.nextElement();
            if (ze.getName().compareToIgnoreCase("META-INF/MANIFEST.MF") != 0)
            {
                jos.putNextEntry(ze);
                copy(jarFile.getInputStream(ze), jos);
            }
        }
       
        jos.close();
       
        // replace existing file if needed
        if (overwrite)
        {
            jarFile.close();
View Full Code Here

Examples of java.util.jar.JarOutputStream

            {
                manifest = "META-INF/MANIFEST.MF";
            }
            m_content = Collections.enumeration(entries);

            m_output = new JarOutputStream(m_outputBuffer);
            readNext(manifest);
            m_buffer = new ByteArrayInputStream(m_outputBuffer.m_outBuffer
                .toByteArray());

            m_outputBuffer.m_outBuffer = null;
View Full Code Here

Examples of java.util.jar.JarOutputStream

        File f = File.createTempFile("felix-bundle", ".jar");
        f.deleteOnExit();

        Manifest mf = new Manifest(new ByteArrayInputStream(manifest.getBytes("utf-8")));
        mf.getMainAttributes().putValue("Manifest-Version", "1.0");
        JarOutputStream os = new JarOutputStream(new FileOutputStream(f), mf);
        os.close();

        return f;
    }
View Full Code Here

Examples of java.util.jar.JarOutputStream

        {
            File f = File.createTempFile("felix-bundle", ".jar");
            f.deleteOnExit();

            Manifest mf = new Manifest(new ByteArrayInputStream(manifest.getBytes("utf-8")));
            JarOutputStream os = new JarOutputStream(new FileOutputStream(f), mf);

            for (Class clazz : classes)
            {
                String path = clazz.getName().replace('.', '/') + ".class";
                os.putNextEntry(new ZipEntry(path));

                InputStream is = clazz.getClassLoader().getResourceAsStream(path);
                byte[] buffer = new byte[8 * 1024];
                for (int i = is.read(buffer); i != -1; i = is.read(buffer))
                {
                    os.write(buffer, 0, i);
                }
                is.close();
                os.closeEntry();
            }
            os.close();
            return f;
        }
View Full Code Here

Examples of java.util.jar.JarOutputStream

        File f = File.createTempFile("felix-bundle", ".jar", tempDir);

        Manifest mf = new Manifest(new ByteArrayInputStream(manifest.getBytes("utf-8")));
        mf.getMainAttributes().putValue("Manifest-Version", "1.0");
        mf.getMainAttributes().putValue(Constants.BUNDLE_ACTIVATOR, TestBundleActivator.class.getName());
        JarOutputStream os = new JarOutputStream(new FileOutputStream(f), mf);

        String path = TestBundleActivator.class.getName().replace('.', '/') + ".class";
        os.putNextEntry(new ZipEntry(path));

        InputStream is = TestBundleActivator.class.getClassLoader().getResourceAsStream(path);
        byte[] b = new byte[is.available()];
        is.read(b);
        is.close();
        os.write(b);

        os.close();
        return f;
    }
View Full Code Here

Examples of java.util.jar.JarOutputStream

    {
        File f = File.createTempFile("felix-bundle", ".jar", tempDir);

        Manifest mf = new Manifest(new ByteArrayInputStream(manifest.getBytes("UTF-8")));
        mf.getMainAttributes().putValue("Manifest-Version", "1.0");
        JarOutputStream os = new JarOutputStream(new FileOutputStream(f), mf);
        os.close();
        return f;
    }
View Full Code Here

Examples of java.util.jar.JarOutputStream

    {
        File f = File.createTempFile("felix-bundle", ".jar");
        f.deleteOnExit();

        Manifest mf = new Manifest(new ByteArrayInputStream(manifest.getBytes("utf-8")));
        JarOutputStream os = new JarOutputStream(new FileOutputStream(f), mf);

        for (Class clazz : classes)
        {
            String path = clazz.getName().replace('.', '/') + ".class";
            os.putNextEntry(new ZipEntry(path));

            InputStream is = clazz.getClassLoader().getResourceAsStream(path);
            byte[] buffer = new byte[8 * 1024];
            for (int i = is.read(buffer); i != -1; i = is.read(buffer))
            {
                os.write(buffer, 0, i);
            }
            is.close();
            os.closeEntry();
        }
        os.close();
        return f;
    }
View Full Code Here

Examples of java.util.jar.JarOutputStream

        }
        m_content = Collections.enumeration(entries);

        try
        {
            m_output = new JarOutputStream(m_outputBuffer);
            readNext(manifest);
            m_buffer = new ByteArrayInputStream(m_outputBuffer.m_outBuffer
                .toByteArray());

            m_outputBuffer.m_outBuffer = null;
View Full Code Here

Examples of java.util.jar.JarOutputStream

    {
        File f = File.createTempFile("felix-bundle", ".jar", tempDir);

        Manifest mf = new Manifest(new ByteArrayInputStream(manifest.getBytes("utf-8")));
        mf.getMainAttributes().putValue("Manifest-Version", "1.0");
        JarOutputStream os = new JarOutputStream(new FileOutputStream(f), mf);
        os.close();
        return f;
    }
View Full Code Here

Examples of java.util.jar.JarOutputStream

    }

    private void createEmptyJar(Manifest man) throws IOException
    {
        FileOutputStream fos = new FileOutputStream(m_jarFile);
        JarOutputStream jos = new JarOutputStream(fos, man);
        jos.close();
    }
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.