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

The following examples show how to use com.liulishuo.filedownloader.util.FileDownloadHelper#ConnectionCountAdapter . 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.ConnectionCountAdapter createConnectionCountAdapter() {
    if (mMaker == null) {
        return createDefaultConnectionCountAdapter();
    }

    final FileDownloadHelper.ConnectionCountAdapter adapter = mMaker.mConnectionCountAdapter;
    if (adapter != null) {
        if (FileDownloadLog.NEED_LOG) {
            FileDownloadLog.d(this, "initial FileDownloader manager with the customize "
                    + "connection count adapter: %s", adapter);
        }
        return adapter;
    } else {
        return createDefaultConnectionCountAdapter();
    }
}
 
Example 2
Source File: CustomComponentHolder.java    From FileDownloader with Apache License 2.0 5 votes vote down vote up
private FileDownloadHelper.ConnectionCountAdapter getConnectionCountAdapter() {
    if (connectionCountAdapter != null) return connectionCountAdapter;

    synchronized (this) {
        if (connectionCountAdapter == null) {
            connectionCountAdapter = getDownloadMgrInitialParams()
                    .createConnectionCountAdapter();
        }
    }

    return connectionCountAdapter;
}
 
Example 3
Source File: DownloadMgrInitialParams.java    From okdownload with Apache License 2.0 4 votes vote down vote up
public InitCustomMaker connectionCountAdapter(
        FileDownloadHelper.ConnectionCountAdapter adapter) {
    return this;
}
 
Example 4
Source File: DownloadMgrInitialParams.java    From FileDownloader with Apache License 2.0 4 votes vote down vote up
private FileDownloadHelper.ConnectionCountAdapter createDefaultConnectionCountAdapter() {
    return new DefaultConnectionCountAdapter();
}
 
Example 5
Source File: DownloadMgrInitialParams.java    From FileDownloader with Apache License 2.0 2 votes vote down vote up
/**
 * customize the connection count adapter.
 *
 * @param adapter the adapter used for determine how many connection will be used to
 *                downloading the target task.
 * @return the connection count adapter.
 */
public InitCustomMaker connectionCountAdapter(
        FileDownloadHelper.ConnectionCountAdapter adapter) {
    this.mConnectionCountAdapter = adapter;
    return this;
}