Package java.util.jar

Examples of java.util.jar.JarEntry


        try {
            jarFile = new JarFile(file);
            Enumeration entries = jarFile.entries();
            while (entries.hasMoreElements()) {
                JarEntry entry = (JarEntry) entries.nextElement();
                name = entry.getName();
                if (!name.startsWith("META-INF/")) {
                    continue;
                }
                if (!name.endsWith(".tld")) {
                    continue;
View Full Code Here


        for (int i = 0; i < classpaths.length; i++) {

            String path = classpaths[i];
            JarFile jarFile = null;
            JarEntry jarEntry = null;

            try {
                jarFile = new JarFile(path);
                jarEntry = findJarEntry(jarFile, classname);
            } catch (IOException ioe) {
View Full Code Here

    private static JarEntry findJarEntry(JarFile jarFile, String entryName) {

        Enumeration entries = jarFile.entries();

        while (entries.hasMoreElements()) {
            JarEntry entry = (JarEntry) entries.nextElement();
            if (entry.getName().equals(entryName)) {
                return entry;
            }
        }

        return null;
View Full Code Here

    }

    private Class loadClassData(JarFile jarFile, String className) {

        String entryName = className.replace('.', '/') + ".class";
        JarEntry jarEntry = findJarEntry(jarFile, entryName);
        if (jarEntry == null) {
            return null;
        }

        // Create the necessary package if needed...
View Full Code Here

        JarFile jar;
        try {
            jar = ((JarURLConnection) url.openConnection()).getJarFile();
            Enumeration<JarEntry> entries = jar.entries();
            while (entries.hasMoreElements()) {
                JarEntry entry = entries.nextElement();
                String name = entry.getName();
                if (!name.startsWith(package2Path) || entry.isDirectory()) {
                    continue;
                }

                // 判断是否递归搜索子包
                if (!recursive && name.lastIndexOf('/') != package2Path.length()) {
View Full Code Here

        JarFile f = null;
        try {
            f = new JarFile(jarFilename);
        } catch (Exception e) {
        }
        JarEntry ent = f.getJarEntry(path);
        if (ent != null) {
            return f.getInputStream(ent);
        }
        return null;
    }
View Full Code Here

        JarFile f = null;
        try {
            f = new JarFile(jarFilename);
        } catch (Exception e) {
        }
        JarEntry ent = f.getJarEntry(path);
        if (ent != null) {
            return f.getInputStream(ent);
        }
        return null;
    }
View Full Code Here

     * @param jar the jar file
     * @return the found file or <code>null</code> if not found.
     * @throws java.io.IOException occurs when the Jar file cannot be read.
     */
    private File findMetadata(JarFile jar) throws IOException {
        JarEntry je = jar.getJarEntry("metadata.xml");
        if (je == null) {
            je = jar.getJarEntry("META-INF/metadata.xml");
        }

        if (je == null) {
            logger.log(LOG_DEBUG, "Metadata file not found, use annotations only.");
            return null; // Not Found, use annotation only
        } else {
            logger.log(LOG_DEBUG, format("Metadata file found at  %s", je.getName()));
            File metadata = File.createTempFile("ipojo-", ".xml", m_temp);
            dump(jar.getInputStream(je), metadata);
            logger.log(LOG_DEBUG, format("Metadata file saved at %s", metadata));
            return metadata;
        }
View Full Code Here

            JarFile jar = new JarFile(jarURL.getFile());
            try {
                List<String> result = new ArrayList<String>();
                Enumeration<JarEntry> en = jar.entries();
                while (en.hasMoreElements()) {
                    JarEntry entry = en.nextElement();
                    String path = entry.getName();
                    boolean match = includes.size() == 0;
                    if (!match) {
                        for (String pattern : includes) {
                            if ( patternMatches(pattern, path)) {
                                match = true;
View Full Code Here

         // open the JAR stream
         jarStream = new JarInputStream(jarUrl.openStream());

         // Loop over all entries of the archive
         JarEntry jarEntry = null;
         while ((jarEntry = jarStream.getNextJarEntry()) != null)
         {

            // We are only interested in java class files
            if (jarEntry.getName().endsWith(".class"))
            {

               // generate FQCN from entry
               String className = getClassName(jarEntry.getName());

               // check name against PackageFilter
               if (mustProcessClass(className))
               {
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.