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

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

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

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

/**
 * Resource iterator factory implementation which delegates to zip then file.
 */
public class ZipThenFileResourceIteratorFactory implements ResourceIteratorFactory {
    private final ResourceIteratorFactory zipResourceIteratorFactory = new ZipResourceIteratorFactory();
    private final ResourceIteratorFactory fileResourceIteratorFactory = new FileResourceIteratorFactory();

    @Override
    public boolean isFactoryFor(URL url) {
        return zipResourceIteratorFactory.isFactoryFor(url) || fileResourceIteratorFactory.isFactoryFor(url);
    }

    @Override
    public Iterator createIterator(URL url, String path, String suffix) {
        if (zipResourceIteratorFactory.isFactoryFor(url)) {
            return zipResourceIteratorFactory.createIterator(url, path, suffix);
        } else {
            return fileResourceIteratorFactory.createIterator(url, path, suffix);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy