Package java.util.jar

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


        throw new InvalidMappingException(
            "Could not read mapping documents from jar: " + jar.getName(), "jar", jar.getName(),
            ioe
        );
      }
      Enumeration jarEntries = jarFile.entries();
      while ( jarEntries.hasMoreElements() ) {
        ZipEntry ze = (ZipEntry) jarEntries.nextElement();
        if ( ze.getName().endsWith( ".hbm.xml" ) ) {
                    LOG.foundMappingDocument(ze.getName());
          try {
View Full Code Here


            while (resources.hasMoreElements()) {
                final URL nextElement = resources.nextElement();
                // Slipt out just the jar file name
                final JarFile jarFile = new JarFile(new File(new URI(nextElement.getPath().split("!")[0])));
                // Go throught all elements in jar and ask for annotation for those in pkg
                for (Enumeration e = jarFile.entries(); e.hasMoreElements();) {
                    JarEntry current = (JarEntry) e.nextElement();
                    final String name = current.getName();
                    // Is at least from the same package as pkg and it is a class
                    if (name.length() > path.length() && name.substring(0, path.length()).equals(path) && name.endsWith(".class")) {
                        try {
View Full Code Here

   */
  public static void unJar(File jarFile, File toDir, Pattern unpackRegex)
    throws IOException {
    JarFile jar = new JarFile(jarFile);
    try {
      Enumeration<JarEntry> entries = jar.entries();
      while (entries.hasMoreElements()) {
        JarEntry entry = (JarEntry)entries.nextElement();
        if (!entry.isDirectory() &&
            unpackRegex.matcher(entry.getName()).matches()) {
          InputStream in = jar.getInputStream(entry);
View Full Code Here

   
    protected URL[] extractArchive() throws Exception {
        final JarFile jarFile = new JarFile(archive);
        try {
            Map<String, JarEntry> jarNames = new HashMap<String, JarEntry>();
            for (Enumeration<JarEntry> e = jarFile.entries(); e.hasMoreElements(); ) {
                JarEntry entry = e.nextElement();
                String extractPath = getExtractEntryPath(entry);
                if ( extractPath != null ) jarNames.put(extractPath, entry);
            }
View Full Code Here

                drivers = new ArrayList<Driver>();
                URL[] urls = new URL[]{new File(libraryName).toURL()};
                URLClassLoader classLoader = new URLClassLoader(urls);

                JarFile jarFile = new JarFile(libraryName);
                Enumeration<JarEntry> entries = jarFile.entries();
                while (entries.hasMoreElements()) {
                    JarEntry entry = entries.nextElement();
                    String name = entry.getName();
                    if (name.endsWith(".class")) {
View Full Code Here

      
       if (dirURL.getProtocol().equals("jar")) {
         /* A JAR path */
         String jarPath = dirURL.getPath().substring(5, dirURL.getPath().indexOf("!")); //strip out only the JAR file
         JarFile jar = new JarFile(URLDecoder.decode(jarPath, "UTF-8"));
         Enumeration<JarEntry> entries = jar.entries(); //gives ALL entries in jar
         Set<String> result = new HashSet<String>(); //avoid duplicates in case it is a subdirectory
         while(entries.hasMoreElements()) {
           String name = entries.nextElement().getName();
           if (name.startsWith(path)) { //filter according to the path
             String entry = name.substring(path.length());
View Full Code Here

        // create temporary directory
        tmpDir.delete();
        tmpDir.mkdir();
       
        try {
            Enumeration<JarEntry> entries = jar.entries();
            while (entries.hasMoreElements()) {
                JarEntry entry = entries.nextElement();
                File out = new File(tmpDir + File.separator + entry.getName());
               
                if (entry.isDirectory()) {
View Full Code Here

                                continue;
                           
                            JarFile jarfile = new JarFile(file);
                            try
                            {
                                Enumeration e = jarfile.entries();
                                while (e.hasMoreElements())
                                {
                                    ZipEntry entry = (ZipEntry)e.nextElement();
                                    String name = entry.getName();
                                    if (name.startsWith("META-INF/") && name.toLowerCase().endsWith(".tld"))
View Full Code Here

        try {
            final JarURLConnection connection = (JarURLConnection) new URI("jar:" + this.location + "!/").toURL().openConnection();
            final JarFile jarFile = connection.getJarFile();

            final Enumeration<JarEntry> entries = jarFile.entries();

            while (entries.hasMoreElements()) {
                final JarEntry entry = entries.nextElement();

                // We only search for class file entries
View Full Code Here

        try {
            final JarURLConnection connection = (JarURLConnection) new URI("jar:" + uri + "!/").toURL().openConnection();
            final JarFile jarFile = connection.getJarFile();

            final Enumeration<JarEntry> entries = jarFile.entries();

            while (entries.hasMoreElements()) {
                final JarEntry entry = entries.nextElement();

                // We only search for class file entries
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.