Package java.util.jar

Examples of java.util.jar.JarInputStream


                processClassEntry(is, name);
                is.close();
            }
            else if (name.endsWith(".jar"))
            {
                JarInputStream jis = new JarInputStream(jarFile.getInputStream(ze));
                processInnerJar(jis, name);
                jis.close();
            }
        }
    }
View Full Code Here


            InputStream is = null;
            try
            {
                URL url = getURL(bundle);
                is = url.openStream();
                JarInputStream js = new JarInputStream(is, false);
                JarEntry entry;
                while ((entry = js.getNextJarEntry()) != null)
                {
                    if (j.equals(entry.getName()))
                    {
                        return true;
                    }
View Full Code Here

            InputStream is = null;
            try
            {
                URL url = getURL(bundle);
                is = url.openStream();
                JarInputStream js = new JarInputStream(is, false);
                Manifest m = js.getManifest();
                if (m != null)
                    return (String) m.getMainAttributes().getValue("Bundle-ClassPath");
            }
            catch (IOException e)
            {
View Full Code Here

                File dir = createEmptyDir(cache);
                FileInputStream fin = null;
                try
                {
                    fin = new FileInputStream(bundle.getLocation());
                    JarInputStream in = new JarInputStream(fin);
                    JarEntry entry;
                    while ((entry = in.getNextJarEntry()) != null)
                    {
                        if (inClasspath(check, entry))
                        {
                            File f = new File(dir, entry.getName());
                            if (entry.isDirectory())
View Full Code Here

        StreamDeploymentPackage source = null;
        AbstractDeploymentPackage target = null;
        boolean succeeded = false;

        try {
            JarInputStream jarInput = null;
            File tempIndex = null;
            File tempContents = null;
            try {
                File tempDir = m_context.getDataFile(TEMP_DIR);
                tempDir.mkdirs();
                tempPackage = File.createTempFile(TEMP_PREFIX, TEMP_POSTFIX, tempDir);
                tempPackage.delete();
                tempPackage.mkdirs();
                tempIndex = new File(tempPackage, PACKAGEINDEX_FILE);
                tempContents = new File(tempPackage, PACKAGECONTENTS_DIR);
                tempContents.mkdirs();
            }
            catch (IOException e) {
                m_log.log(LogService.LOG_ERROR, "Error writing package to disk", e);
                throw new DeploymentException(CODE_OTHER_ERROR, "Error writing package to disk", e);
            }

            try {
                jarInput = new ContentCopyingJarInputStream(sourceInput, tempIndex, tempContents);

                if (jarInput.getManifest() == null) {
                    m_log.log(LogService.LOG_ERROR, "Stream does not contain a valid deployment package: missing manifest!");
                    throw new DeploymentException(CODE_MISSING_HEADER, "No manifest present in deployment package!");
                }
            }
            catch (IOException e) {
View Full Code Here

        if (mf == null)
        {
            InputStream in = uri.toURL().openStream();
            try
            {
                JarInputStream jin = new JarInputStream(in);
                mf = jin.getManifest();
                if (mf == null)
                {
                    for (;;)
                    {
                        JarEntry entry = jin.getNextJarEntry();
                        if (entry == null)
                            break;
                        if ("META-INF/MANIFEST.MF".equals(entry.getName()))
                        {
                            mf = new Manifest(jin);
View Full Code Here

            is.close();

            if (extract)
            {
                is = new FileInputStream(file);
                JarInputStream jis = new JarInputStream(is);
                out.println("Extracting...");
                unjar(jis, dir);
                jis.close();
                file.delete();
            }
        }
        catch (Exception ex)
        {
View Full Code Here

    }

    private X509Certificate[] getCertificates(InputStream input, boolean check)
        throws IOException
    {
        JarInputStream bundle = new JarInputStream(input, true);

        if (bundle.getManifest() == null)
        {
            return null;
        }

        List certificateChains = new ArrayList();

        int count = certificateChains.size();

        // This is tricky: jdk1.3 doesn't say anything about what is happening
        // if a bad sig is detected on an entry - later jdk's do say that they
        // will throw a security Exception. The below should cater for both
        // behaviors.
        for (JarEntry entry = bundle.getNextJarEntry(); entry != null; entry = bundle
            .getNextJarEntry())
        {

            if (entry.isDirectory() ||
                (entry.getName().startsWith("META-INF/") &&
                (entry.getName().indexOf('/', "META-INF/".length()) < 0)))
            {
                continue;
            }

            for (byte[] tmp = new byte[4096]; bundle.read(tmp, 0, tmp.length) != -1;)
            {
            }

            Certificate[] certificates = entry.getCertificates();
View Full Code Here

            is.close();

            if (extract)
            {
                is = new FileInputStream(file);
                JarInputStream jis = new JarInputStream(is);
                out.println("Extracting...");
                unjar(jis, localDir);
                jis.close();
                file.delete();
            }
        }
        catch (Exception ex)
        {
View Full Code Here

     */
    private Manifest getManifest(final InputStream ins) throws IOException {
        Manifest result = null;

        if ( ins != null ) {
            JarInputStream jis = null;
            try {
                jis = new JarInputStream(ins);
                result= jis.getManifest();

            } finally {

                // close the jar stream or the inputstream, if the jar
                // stream is set, we don't need to close the input stream
                // since closing the jar stream closes the input stream
                if (jis != null) {
                    try {
                        jis.close();
                    } catch (final IOException ignore) {
                    }
                } else {
                    try {
                        ins.close();
View Full Code Here

TOP

Related Classes of java.util.jar.JarInputStream

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.