Java Code Examples for com.liulishuo.filedownloader.util.FileDownloadHelper#ConnectionCreator

The following examples show how to use com.liulishuo.filedownloader.util.FileDownloadHelper#ConnectionCreator . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DownloadMgrInitialParams.java    From FileDownloader with Apache License 2.0 6 votes vote down vote up
public FileDownloadHelper.ConnectionCreator createConnectionCreator() {
    if (mMaker == null) {
        return createDefaultConnectionCreator();
    }

    final FileDownloadHelper.ConnectionCreator connectionCreator = mMaker.mConnectionCreator;

    if (connectionCreator != null) {
        if (FileDownloadLog.NEED_LOG) {
            FileDownloadLog.d(this, "initial FileDownloader manager with the customize "
                    + "connection creator: %s", connectionCreator);
        }
        return connectionCreator;
    } else {
        return createDefaultConnectionCreator();
    }
}
 
Example 2
Source File: CustomComponentHolder.java    From FileDownloader with Apache License 2.0 5 votes vote down vote up
private FileDownloadHelper.ConnectionCreator getConnectionCreator() {
    if (connectionCreator != null) return connectionCreator;

    synchronized (this) {
        if (connectionCreator == null) {
            connectionCreator = getDownloadMgrInitialParams().createConnectionCreator();
        }
    }

    return connectionCreator;
}
 
Example 3
Source File: DownloadConnectionAdapter.java    From okdownload with Apache License 2.0 4 votes vote down vote up
public Factory(@NonNull FileDownloadHelper.ConnectionCreator creator) {
    this.creator = creator;
}
 
Example 4
Source File: DownloadMgrInitialParams.java    From FileDownloader with Apache License 2.0 4 votes vote down vote up
private FileDownloadHelper.ConnectionCreator createDefaultConnectionCreator() {
    return new FileDownloadUrlConnection.Creator();
}
 
Example 5
Source File: DownloadMgrInitialParams.java    From okdownload with Apache License 2.0 2 votes vote down vote up
/**
 * Customize the connection component.
 * <p>
 * If you don't customize the connection component, we use
 * {@link com.liulishuo.okdownload.core.connection.DownloadUrlConnection}
 *
 * @param creator the connection creator will used for create the connection when start
 *                downloading any task in the FileDownloader.
 */
public InitCustomMaker connectionCreator(FileDownloadHelper.ConnectionCreator creator) {
    this.mConnectionCreator = creator;
    return this;
}
 
Example 6
Source File: DownloadMgrInitialParams.java    From FileDownloader with Apache License 2.0 2 votes vote down vote up
/**
 * Customize the connection component.
 * <p>
 * If you don't customize the connection component, we use the result of
 * {@link #createDefaultConnectionCreator()} as the default one.
 *
 * @param creator the connection creator will used for create the connection when start
 *                downloading any task in the FileDownloader.
 */
public InitCustomMaker connectionCreator(FileDownloadHelper.ConnectionCreator creator) {
    this.mConnectionCreator = creator;
    return this;
}