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

org.jgroups.ping.common.stream.OpenStream Maven / Gradle / Ivy

The newest version!
package org.jgroups.ping.common.stream;

import java.io.InputStream;
import java.util.Map;
import java.util.concurrent.Callable;

public class OpenStream implements Callable {

    private final StreamProvider streamProvider;
    private final String url;
    private final Map headers;
    private final int connectTimeout;
    private final int readTimeout;

    public OpenStream(StreamProvider streamProvider, String url, Map headers, int connectTimeout, int readTimeout) {
        this.streamProvider = (streamProvider != null) ? streamProvider : new DefaultStreamProvider();
        this.url = url;
        this.headers = headers;
        this.connectTimeout = connectTimeout;
        this.readTimeout = readTimeout;
    }

    @Override
    public InputStream call() throws Exception {
        return streamProvider.openStream(url, headers, connectTimeout, readTimeout);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy