当前位置: 首页>>代码示例>>Java>>正文


Java FileDownloadLog类代码示例

本文整理汇总了Java中com.liulishuo.filedownloader.util.FileDownloadLog的典型用法代码示例。如果您正苦于以下问题:Java FileDownloadLog类的具体用法?Java FileDownloadLog怎么用?Java FileDownloadLog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


FileDownloadLog类属于com.liulishuo.filedownloader.util包,在下文中一共展示了FileDownloadLog类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: unbindByContext

import com.liulishuo.filedownloader.util.FileDownloadLog; //导入依赖的package包/类
@Override
public void unbindByContext(final Context context) {
    if (!BIND_CONTEXTS.contains(context)) {
        return;
    }

    if (FileDownloadLog.NEED_LOG) {
        FileDownloadLog.d(this, "unbindByContext %s", context);
    }

    BIND_CONTEXTS.remove(context);


    if (BIND_CONTEXTS.isEmpty()) {
        releaseConnect(false);
    }

    Intent i = new Intent(context, serviceClass);
    context.unbindService(this);
    context.stopService(i);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:22,代码来源:BaseFileServiceUIGuard.java

示例2: onAssembledTasksToStart

import com.liulishuo.filedownloader.util.FileDownloadLog; //导入依赖的package包/类
private boolean onAssembledTasksToStart(int attachKey, final List<BaseDownloadTask.IRunningTask> list,
                                        final FileDownloadListener listener, boolean isSerial) {
    if (FileDownloadMonitor.isValid()) {
        FileDownloadMonitor.getMonitor().onRequestStart(list.size(), true, listener);
    }

    if (FileDownloadLog.NEED_LOG) {
        FileDownloadLog.v(FileDownloader.class, "start list attachKey[%d] size[%d] " +
                "listener[%s] isSerial[%B]", attachKey, list.size(), listener, isSerial);
    }

    if (list == null || list.isEmpty()) {
        FileDownloadLog.w(FileDownloader.class, "Tasks with the listener can't start, " +
                        "because can't find any task with the provided listener, maybe tasks " +
                        "instance has been started in the past, so they are all are inUsing, if " +
                        "in this case, you can use [BaseDownloadTask#reuse] to reuse theme " +
                        "first then start again: [%s, %B]",
                listener, isSerial);

        return true;
    }

    return false;

}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:26,代码来源:QueuesHandler.java

示例3: onRetry

import com.liulishuo.filedownloader.util.FileDownloadLog; //导入依赖的package包/类
@Override
public void onRetry(Exception exception, long invalidIncreaseBytes) {
    if (paused) {
        if (FileDownloadLog.NEED_LOG) {
            FileDownloadLog.d(this, "the task[%d] has already been paused, so pass the" +
                    " retry callback", model.getId());
        }
        return;
    }

    if (validRetryTimes-- < 0) {
        FileDownloadLog.e(this, "valid retry times is less than 0(%d) for download task(%d)",
                validRetryTimes, model.getId());
    }

    statusCallback.onRetry(exception, validRetryTimes--, invalidIncreaseBytes);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:18,代码来源:DownloadLaunchRunnable.java

示例4: sync

import com.liulishuo.filedownloader.util.FileDownloadLog; //导入依赖的package包/类
private void sync() {
    final long startTimestamp = SystemClock.uptimeMillis();
    try {
        outputStream.sync();
    } catch (IOException e) {
        e.printStackTrace();
    }

    final boolean isBelongMultiConnection = hostRunnable != null;
    if (isBelongMultiConnection) {
        // only need update the connection table.
        database.updateConnectionModel(downloadId, connectionIndex, currentOffset);
    } else {
        // only need update the filedownloader table.
        callback.syncProgressFromCache();
    }

    if (FileDownloadLog.NEED_LOG) {
        FileDownloadLog.d(this, "require sync id[%d] index[%d] offset[%d], consume[%d]",
                downloadId, connectionIndex, currentOffset, SystemClock.uptimeMillis() - startTimestamp);
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:23,代码来源:FetchDataTask.java

示例5: connect

import com.liulishuo.filedownloader.util.FileDownloadLog; //导入依赖的package包/类
FileDownloadConnection connect() throws IOException, IllegalAccessException {
    FileDownloadConnection connection = CustomComponentHolder.getImpl().createConnection(url);

    addUserRequiredHeader(connection);
    addRangeHeader(connection);

    // init request
    // get the request header in here, because of there are many connection
    // component(such as HttpsURLConnectionImpl, HttpURLConnectionImpl in okhttp3) don't
    // allow access to the request header after it connected.
    requestHeader = connection.getRequestHeaderFields();
    if (FileDownloadLog.NEED_LOG) {
        FileDownloadLog.d(this, "%s request header %s", downloadId, requestHeader);
    }

    connection.execute();
    redirectedUrlList = new ArrayList<>();
    connection = RedirectHandler.process(requestHeader, connection, redirectedUrlList);

    return connection;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:22,代码来源:ConnectTask.java

示例6: onStatusChanged

import com.liulishuo.filedownloader.util.FileDownloadLog; //导入依赖的package包/类
private void onStatusChanged(final byte status) {
    // In current situation, it maybe invoke this method simultaneously between #onPause() and
    // others.
    if (model.getStatus() == FileDownloadStatus.paused) {
        if (FileDownloadLog.NEED_LOG) {
            /**
             * Already paused or the current status is paused.
             *
             * We don't need to call-back to Task in here, because the pause status has
             * already handled by {@link BaseDownloadTask#pause()} manually.
             *
             * In some case, it will arrive here by High concurrent cause.  For performance
             * more make sense.
             *
             * High concurrent cause.
             */
            FileDownloadLog.d(this, "High concurrent cause, Already paused and we don't " +
                    "need to call-back to Task in here, %d", model.getId());
        }
        return;
    }

    MessageSnapshotFlow.getImpl().inflow(MessageSnapshotTaker.take(status, model, processParams));
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:25,代码来源:DownloadStatusCallback.java

示例7: setMaxNetworkThreadCount

import com.liulishuo.filedownloader.util.FileDownloadLog; //导入依赖的package包/类
public synchronized boolean setMaxNetworkThreadCount(int count) {
    if (exactSize() > 0) {
        FileDownloadLog.w(this, "Can't change the max network thread count, because the " +
                " network thread pool isn't in IDLE, please try again after all running" +
                " tasks are completed or invoking FileDownloader#pauseAll directly.");
        return false;
    }

    final int validCount = FileDownloadProperties.getValidNetworkThreadCount(count);

    if (FileDownloadLog.NEED_LOG) {
        FileDownloadLog.d(this, "change the max network thread count, from %d to %d",
                mMaxThreadCount, validCount);
    }

    final List<Runnable> taskQueue = mThreadPool.shutdownNow();
    mThreadPool = FileDownloadExecutors.newDefaultThreadPool(validCount, THREAD_PREFIX);

    if (taskQueue.size() > 0) {
        FileDownloadLog.w(this, "recreate the network thread pool and discard %d tasks",
                taskQueue.size());
    }

    mMaxThreadCount = validCount;
    return true;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:27,代码来源:FileDownloadThreadPool.java

示例8: onServiceConnected

import com.liulishuo.filedownloader.util.FileDownloadLog; //导入依赖的package包/类
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
    this.service = asInterface(service);

    if (FileDownloadLog.NEED_LOG) {
        FileDownloadLog.d(this, "onServiceConnected %s %s", name, this.service);
    }

    try {
        registerCallback(this.service, this.callback);
    } catch (RemoteException e) {
        e.printStackTrace();
    }

    @SuppressWarnings("unchecked") final List<Runnable> runnableList =
            (List<Runnable>) connectedRunnableList.clone();
    connectedRunnableList.clear();
    for (Runnable runnable : runnableList) {
        runnable.run();
    }

    FileDownloadEventPool.getImpl().
            asyncPublishInNewThread(new DownloadServiceConnectChangedEvent(
                    DownloadServiceConnectChangedEvent.ConnectStatus.connected, serviceClass));

}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:27,代码来源:BaseFileServiceUIGuard.java

示例9: releaseConnect

import com.liulishuo.filedownloader.util.FileDownloadLog; //导入依赖的package包/类
private void releaseConnect(final boolean isLost) {
    if (!isLost && this.service != null) {
        try {
            unregisterCallback(this.service, this.callback);
        } catch (RemoteException e) {
            e.printStackTrace();
        }
    }
    if (FileDownloadLog.NEED_LOG) {
        FileDownloadLog.d(this, "release connect resources %s", this.service);
    }
    this.service = null;

    FileDownloadEventPool.getImpl().
            asyncPublishInNewThread(new DownloadServiceConnectChangedEvent(
                    isLost ? DownloadServiceConnectChangedEvent.ConnectStatus.lost :
                            DownloadServiceConnectChangedEvent.ConnectStatus.disconnected,
                    serviceClass));
}
 
开发者ID:yannanzheng,项目名称:FileDownloader-master,代码行数:20,代码来源:BaseFileServiceUIGuard.java

示例10: update

import com.liulishuo.filedownloader.util.FileDownloadLog; //导入依赖的package包/类
@Override
public void update(FileDownloadModel downloadModel) {
    if (downloadModel == null) {
        FileDownloadLog.w(this, "update but model == null!");
        return;
    }

    if (find(downloadModel.getId()) != null) {
        // 替换
        downloaderModelMap.remove(downloadModel.getId());
        downloaderModelMap.put(downloadModel.getId(), downloadModel);

        // db
        ContentValues cv = downloadModel.toContentValues();
        db.update(TABLE_NAME, cv, FileDownloadModel.ID + " = ? ", new String[]{String.valueOf(downloadModel.getId())});
    } else {
        insert(downloadModel);
    }
}
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:20,代码来源:DefaultDatabaseImpl.java

示例11: getMaxNetworkThreadCount

import com.liulishuo.filedownloader.util.FileDownloadLog; //导入依赖的package包/类
public int getMaxNetworkThreadCount() {
    if (mMaker == null) {
        return getDefaultMaxNetworkThreadCount();
    }

    final Integer customizeMaxNetworkThreadCount = mMaker.mMaxNetworkThreadCount;

    if (customizeMaxNetworkThreadCount != null) {
        if (FileDownloadLog.NEED_LOG) {
            FileDownloadLog.d(this, "initial FileDownloader manager with the customize " +
                    "maxNetworkThreadCount: %d", customizeMaxNetworkThreadCount);
        }

        return FileDownloadProperties.getValidNetworkThreadCount(customizeMaxNetworkThreadCount);
    } else {
        return getDefaultMaxNetworkThreadCount();
    }

}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:20,代码来源:DownloadMgrInitialParams.java

示例12: createDatabase

import com.liulishuo.filedownloader.util.FileDownloadLog; //导入依赖的package包/类
public FileDownloadDatabase createDatabase() {
    if (mMaker == null || mMaker.mDatabaseCustomMaker == null) {
        return createDefaultDatabase();
    }
    final FileDownloadDatabase customDatabase = mMaker.mDatabaseCustomMaker.customMake();

    if (customDatabase != null) {
        if (FileDownloadLog.NEED_LOG) {
            FileDownloadLog.d(this, "initial FileDownloader manager with the customize " +
                    "database: %s", customDatabase);
        }
        return customDatabase;
    } else {
        return createDefaultDatabase();
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:17,代码来源:DownloadMgrInitialParams.java

示例13: createConnectionCountAdapter

import com.liulishuo.filedownloader.util.FileDownloadLog; //导入依赖的package包/类
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();
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:17,代码来源:DownloadMgrInitialParams.java

示例14: createIdGenerator

import com.liulishuo.filedownloader.util.FileDownloadLog; //导入依赖的package包/类
public FileDownloadHelper.IdGenerator createIdGenerator() {
    if (mMaker == null) {
        return createDefaultIdGenerator();
    }

    final FileDownloadHelper.IdGenerator idGenerator = mMaker.mIdGenerator;
    if (idGenerator != null) {
        if (FileDownloadLog.NEED_LOG) {
            FileDownloadLog.d(this, "initial FileDownloader manager with the customize " +
                    "id generator: %s", idGenerator);
        }

        return idGenerator;
    } else {
        return createDefaultIdGenerator();
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:18,代码来源:DownloadMgrInitialParams.java

示例15: publish

import com.liulishuo.filedownloader.util.FileDownloadLog; //导入依赖的package包/类
@Override
public boolean publish(final IDownloadEvent event) {
    if (FileDownloadLog.NEED_LOG) {
        FileDownloadLog.v(this, "publish %s", event.getId());
    }
    Assert.assertNotNull("EventPoolImpl.publish", event);
    String eventId = event.getId();
    LinkedList<IDownloadListener> listeners = listenersMap.get(eventId);
    if (listeners == null) {
        synchronized (eventId.intern()) {
            listeners = listenersMap.get(eventId);
            if (listeners == null) {
                if (FileDownloadLog.NEED_LOG) {
                    FileDownloadLog.d(this, "No listener for this event %s", eventId);
                }
                return false;
            }
        }
    }

    trigger(listeners, event);
    return true;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:24,代码来源:DownloadEventPoolImpl.java


注:本文中的com.liulishuo.filedownloader.util.FileDownloadLog类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。