All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cucumber.runtime.io.ZipResourceIteratorFactory Maven / Gradle / Ivy

There is a newer version: 7.18.0
Show newest version
package cucumber.runtime.io;

import java.io.IOException;
import java.net.URL;
import java.util.Iterator;

import cucumber.runtime.CucumberException;

/**
 * Factory which creates {@link ZipResourceIterator}s for URL's with "jar", "zip" and "wsjar"
 * protocols.
 */
public class ZipResourceIteratorFactory implements ResourceIteratorFactory {

    @Override
    public boolean isFactoryFor(URL url) {
        return url.getFile().contains("!/");
    }

    @Override
    public Iterator createIterator(URL url, String path, String suffix) {
        try {
            String jarPath = Helpers.jarFilePath(url);
            return new ZipResourceIterator(jarPath, path, suffix);
        } catch (IOException e) {
            throw new CucumberException(e);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy