Package java.util.jar

Examples of java.util.jar.JarFile.entries()


    private void processJarPackages(File jarFile, Set<String> packageSet ){
        JarFile jar = null;
        try {
            jar = new JarFile(jarFile, false);
            Enumeration<JarEntry> entries = jar.entries();
            while (entries.hasMoreElements()) {
                String entryName = entries.nextElement().getName();
                if (entryName.endsWith(".class")
                        && !entryName.startsWith("META-INF/")
                        && !entryName.startsWith("javax/")) {
View Full Code Here


            entries.add(new JarEntry(path));
        }
       
        when(cl.getResource(Matchers.contains("install"))).thenReturn(url);
        when(conn.getJarFile()).thenReturn(f);
        when(f.entries()).thenReturn(entries.elements());
       
        return cl;
    }
   
    private void assertChildren(ClassLoaderResourceProvider p, String path, String ... expected) {
View Full Code Here

        try {
            if (redeployMode) {
                conn.setUseCaches(false);
            }
            jarFile = conn.getJarFile();
            Enumeration entries = jarFile.entries();
            while (entries.hasMoreElements()) {
                JarEntry entry = (JarEntry) entries.nextElement();
                String name = entry.getName();
                if (!name.startsWith("META-INF/")) continue;
                if (!name.endsWith(".tld")) continue;
View Full Code Here

     */
    private static void scanJar(File f, Pattern pattern,
            List<String> classPathMatches) throws URISyntaxException,
            IOException {
        JarFile jarFile = new JarFile(f);
        for (Enumeration<JarEntry> e = jarFile.entries(); e.hasMoreElements();) {
            JarEntry je = e.nextElement();
            String entryName = je.getName();
            if (pattern.matcher(entryName).matches()) {
                classPathMatches.add(entryName);
            }
View Full Code Here

            children = new ArrayList<String>();
            try {
                URLConnection conn = url.openConnection();
                if (conn instanceof JarURLConnection) {
                    JarFile jar = ((JarURLConnection) conn).getJarFile();
                    Enumeration<JarEntry> entries = jar.entries();
                    while (entries.hasMoreElements()) {
                        String entry = entries.nextElement().getName();
                        if (pathPattern.matcher(entry).matches()) {
                            children.add(entry);
                        }
View Full Code Here

        }

        int found = 0;

        JarFile jarFile = new JarFile(artifactPath);
        Enumeration<JarEntry> entries = jarFile.entries();
        while (entries.hasMoreElements()) {
            JarEntry entry = entries.nextElement();
            if (entry.getName().endsWith(".tld")) {
                found++;
            }
View Full Code Here

        final File tmpTo = File.createTempFile("jarjar", ".jar");
        JarOutputStream out = new JarOutputStream(new FileOutputStream(tmpTo));
        Set<String> entries = new HashSet<String>();
        try {
            EntryStruct struct = new EntryStruct();
            Enumeration<JarEntry> e = in.entries();
            while (e.hasMoreElements()) {
                JarEntry entry = e.nextElement();
                struct.name = entry.getName();
                struct.time = entry.getTime();
                ByteArrayOutputStream baos = new ByteArrayOutputStream();
View Full Code Here

        try {
          jar = new JarFile(file);
        } catch (Exception ex) { 
        }
        if (jar != null) {
          Enumeration<JarEntry> entries = jar.entries();
          while (entries.hasMoreElements()) {
            JarEntry entry = entries.nextElement();
            String name = entry.getName();           
            int extIndex = name.lastIndexOf(".class");
            if (extIndex > 0 && !name.contains("$")) {
View Full Code Here

     */
    private Collection<String> findClassesInJar(File file) throws IOException {
        Collection<String> classes = new ArrayList<String>();

        JarFile jar = new JarFile(file);
        Enumeration<JarEntry> e = jar.entries();
        while (e.hasMoreElements()) {
            JarEntry entry = e.nextElement();
            if (entry.getName().endsWith(".class")) {
                String nameWithoutExtension = entry.getName().replaceAll(
                        "\\.class", "");
View Full Code Here

    LOG.debugf( "Seeking mapping documents in jar file : %s", jar.getName() );
    final Origin origin = new Origin( SourceType.JAR, jar.getAbsolutePath() );
    try {
      JarFile jarFile = new JarFile( jar );
      try {
        Enumeration jarEntries = jarFile.entries();
        while ( jarEntries.hasMoreElements() ) {
          final ZipEntry zipEntry = (ZipEntry) jarEntries.nextElement();
          if ( zipEntry.getName().endsWith( ".hbm.xml" ) ) {
            LOG.tracef( "found mapping document : %s", zipEntry.getName() );
            try {
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.