com.cloudconvert.resource.async.AsyncFilesResource Maven / Gradle / Ivy
package com.cloudconvert.resource.async;
import com.cloudconvert.client.mapper.ObjectMapperProvider;
import com.cloudconvert.client.setttings.SettingsProvider;
import com.cloudconvert.dto.result.AsyncResult;
import com.cloudconvert.executor.AsyncRequestExecutor;
import com.cloudconvert.resource.AbstractFilesResource;
import lombok.extern.slf4j.Slf4j;
import org.jetbrains.annotations.NotNull;
import java.io.IOException;
import java.io.InputStream;
import java.net.URISyntaxException;
@Slf4j
public class AsyncFilesResource extends AbstractFilesResource> {
private final AsyncRequestExecutor asyncRequestExecutor;
public AsyncFilesResource(
final SettingsProvider settingsProvider,
final ObjectMapperProvider objectMapperProvider, final AsyncRequestExecutor asyncRequestExecutor
) {
super(settingsProvider, objectMapperProvider);
this.asyncRequestExecutor = asyncRequestExecutor;
}
@Override
public AsyncResult download(
@NotNull final String path
) throws IOException, URISyntaxException {
return asyncRequestExecutor.execute(getDownloadHttpUriRequest(path), INPUT_STREAM_TYPE_REFERENCE);
}
@Override
public void close() throws IOException {
asyncRequestExecutor.close();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy