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

com.cloudconvert.resource.AbstractFilesResource Maven / Gradle / Ivy

Go to download

CloudConvert is an online file converter API - more than 200 different audio, video, document, ebook, archive, image, spreadsheet and presentation formats supported.

There is a newer version: 1.2.1
Show newest version
package com.cloudconvert.resource;

import com.cloudconvert.client.mapper.ObjectMapperProvider;
import com.cloudconvert.client.setttings.SettingsProvider;
import com.cloudconvert.dto.result.AbstractResult;
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.client.methods.RequestBuilder;
import org.apache.http.client.utils.URIBuilder;
import org.jetbrains.annotations.NotNull;

import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
import java.net.URISyntaxException;

public abstract class AbstractFilesResource> extends AbstractResource {

    public AbstractFilesResource(
        final SettingsProvider settingsProvider, final ObjectMapperProvider objectMapperProvider
    ) {
        super(settingsProvider, objectMapperProvider);
    }

    /**
     * Download file
     *
     * @param path path to file
     * @return IS
     * @throws IOException
     * @throws URISyntaxException
     */
    public abstract ISAR download(
        @NotNull final String path
    ) throws IOException, URISyntaxException;

    protected HttpUriRequest getDownloadHttpUriRequest(
        @NotNull final String path
    ) throws URISyntaxException {
        final URI uri = new URIBuilder(path).build();

        return RequestBuilder.get().setUri(uri).build();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy