xyz.deftu.fd.FileDownloaderFactory Maven / Gradle / Ivy
package xyz.deftu.fd;
import java.io.File;
/**
* A factory for instantiation of {@link FileDownloader}s,
* this can be used to create multiple downloaders with
* properties predefined.
*/
public interface FileDownloaderFactory {
// Creating.
/**
* Creates a {@link FileDownloader} with predefined properties
* from the factory.
*
* @param tempDir The directory temporary downloads are stored in.
* @param existingFile The existing file, may be null if there is none.
* @return A new {@link FileDownloader} with predefined properties based on the factory.
*/
FileDownloader create(File tempDir, File existingFile);
/**
* Creates a {@link FileDownloader} with predefined properties
* from the factory.
*
* @param tempDir The directory temporary downloads are stored in.
* @return A new {@link FileDownloader} with predefined properties based on the factory.
*/
FileDownloader create(File tempDir);
// Properties.
/**
* Applies predefined caches values to this {@link FileDownloaderFactory}.
*
* @param caches The predefined value for caches.
* @return The {@link FileDownloaderFactory} itself.
*/
FileDownloaderFactory withCaches(boolean caches);
/**
* Applies predefined userAgent values to this {@link FileDownloaderFactory}.
*
* @param userAgent The predefined value for userAgent.
* @return The {@link FileDownloaderFactory} itself.
*/
FileDownloaderFactory withUserAgent(String userAgent);
/**
* Applies predefined timeout values to this {@link FileDownloaderFactory}.
*
* @param timeout The predefined value for timeout.
* @return The {@link FileDownloaderFactory} itself.
*/
FileDownloaderFactory withTimeout(int timeout);
/**
* Creates a new instance of a {@link FileDownloaderFactory}.
*
* @return A new instance of {@link FileDownloaderFactory}.
*/
static FileDownloaderFactory create() {
return new FileDownloaderFactoryImpl();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy