• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java FileDownloadLog类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: addUnchecked

import com.liulishuo.filedownloader.util.FileDownloadLog; //导入依赖的package包/类
/**
 * This method generally used for enqueuing the task which will be assembled by a queue.
 *
 * @see BaseDownloadTask.InQueueTask#enqueue()
 */
void addUnchecked(final BaseDownloadTask.IRunningTask task) {
    if (task.isMarkedAdded2List()) {
        return;
    }

    synchronized (mList) {
        if (mList.contains(task)) {
            FileDownloadLog.w(this, "already has %s", task);
        } else {
            task.markAdded2List();
            mList.add(task);
            if (FileDownloadLog.NEED_LOG) {
                FileDownloadLog.v(this, "add list in all %s %d %d", task,
                        task.getOrigin().getStatus(), mList.size());
            }
        }
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:24,代码来源:FileDownloadList.java


示例17: notifyBegin

import com.liulishuo.filedownloader.util.FileDownloadLog; //导入依赖的package包/类
@Override
public boolean notifyBegin() {
    if (FileDownloadLog.NEED_LOG) {
        FileDownloadLog.d(this, "notify begin %s", mTask);
    }

    if (mTask == null) {
        FileDownloadLog.w(this, "can't begin the task, the holder fo the messenger is nil, %d",
                parcelQueue.size());
        return false;
    }

    mLifeCycleCallback.onBegin();

    return true;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:17,代码来源:FileDownloadMessenger.java


示例18: notifyProgress

import com.liulishuo.filedownloader.util.FileDownloadLog; //导入依赖的package包/类
@Override
public void notifyProgress(MessageSnapshot snapshot) {
    final BaseDownloadTask originTask = mTask.getOrigin();
    if (FileDownloadLog.NEED_LOG) {
        FileDownloadLog.d(this, "notify progress %s %d %d",
                originTask, originTask.getLargeFileSoFarBytes(), originTask.getLargeFileTotalBytes());
    }
    if (originTask.getCallbackProgressTimes() <= 0) {
        if (FileDownloadLog.NEED_LOG) {
            FileDownloadLog.d(this, "notify progress but client not request notify %s", mTask);
        }
        return;
    }

    mLifeCycleCallback.onIng();

    process(snapshot);

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


示例19: sendMessage

import com.liulishuo.filedownloader.util.FileDownloadLog; //导入依赖的package包/类
private synchronized void sendMessage(Message message) {

        if (!handlerThread.isAlive()) {
            if (FileDownloadLog.NEED_LOG) {
                FileDownloadLog.d(this, ALREADY_DEAD_MESSAGE, message.what);
            }
            return;
        }

        try {
            handler.sendMessage(message);
        } catch (IllegalStateException e) {
            if (!handlerThread.isAlive()) {
                if (FileDownloadLog.NEED_LOG) {
                    FileDownloadLog.d(this, ALREADY_DEAD_MESSAGE, message.what);
                }
            } else {
                // unknown error
                throw e;
            }
        }
    }
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:23,代码来源:DownloadStatusCallback.java


示例20: onOver

import com.liulishuo.filedownloader.util.FileDownloadLog; //导入依赖的package包/类
@Override
public void onOver() {
    final BaseDownloadTask origin = mTask.getRunningTask().getOrigin();

    if (FileDownloadMonitor.isValid()) {
        FileDownloadMonitor.getMonitor().onTaskOver(origin);
    }

    if (FileDownloadLog.NEED_LOG) {
        FileDownloadLog.v(this, "filedownloader:lifecycle:over %s by %d ", toString(),
                getStatus());
    }

    mSpeedMonitor.end(this.mSoFarBytes);
    if (mTask.getFinishListenerList() != null) {
        @SuppressWarnings("unchecked") final ArrayList<BaseDownloadTask.FinishListener>
                listenersCopy =
                (ArrayList<BaseDownloadTask.FinishListener>) mTask.getFinishListenerList().clone();
        final int numListeners = listenersCopy.size();
        for (int i = 0; i < numListeners; ++i) {
            listenersCopy.get(i).over(origin);
        }
    }

    FileDownloader.getImpl().getLostConnectedHandler().taskWorkFine(mTask.getRunningTask());
}
 
开发者ID:yannanzheng,项目名称:FileDownloader-master,代码行数:27,代码来源:DownloadTaskHunter.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ATexture类代码示例发布时间:2022-05-23
下一篇:
Java HotKey类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap