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


Java FileDownloadLog.w方法代码示例

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


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

示例1: 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:yannanzheng,项目名称:FileDownloader-master,代码行数:26,代码来源:QueuesHandler.java

示例2: 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:yannanzheng,项目名称:FileDownloader-master,代码行数:27,代码来源:FileDownloadThreadPool.java

示例3: 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:angcyo,项目名称:RLibrary,代码行数:24,代码来源:FileDownloadList.java

示例4: 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

示例5: pause

import com.liulishuo.filedownloader.util.FileDownloadLog; //导入方法依赖的package包/类
/**
 * Pause downloading tasks with the {@code id}.
 *
 * @param id the {@code id} .
 * @return The size of tasks has been paused.
 * @see #pause(FileDownloadListener)
 */
public int pause(final int id) {
    List<BaseDownloadTask.IRunningTask> taskList = FileDownloadList.getImpl().getDownloadingList(id);
    if (null == taskList || taskList.isEmpty()) {
        FileDownloadLog.w(this, "request pause but not exist %d", id);
        return 0;
    }

    for (BaseDownloadTask.IRunningTask task : taskList) {
        task.getOrigin().pause();
    }

    return taskList.size();
}
 
开发者ID:yannanzheng,项目名称:FileDownloader-master,代码行数:21,代码来源:FileDownloader.java

示例6: start

import com.liulishuo.filedownloader.util.FileDownloadLog; //导入方法依赖的package包/类
/**
 * Start the download queue by the same listener.
 *
 * @param listener Used to assemble tasks which is bound by the same {@code listener}
 * @param isSerial Whether start tasks one by one rather than parallel.
 * @return {@code true} if start tasks successfully.
 */
public boolean start(final FileDownloadListener listener, final boolean isSerial) {

    if (listener == null) {
        FileDownloadLog.w(this, "Tasks with the listener can't start, because the listener " +
                "provided is null: [null, %B]", isSerial);
        return false;
    }


    return isSerial ?
            getQueuesHandler().startQueueSerial(listener) :
            getQueuesHandler().startQueueParallel(listener);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:21,代码来源:FileDownloader.java

示例7: setMaxNetworkThreadCount

import com.liulishuo.filedownloader.util.FileDownloadLog; //导入方法依赖的package包/类
/**
 * Set the maximum count of the network thread, what is the number of simultaneous downloads in
 * FileDownloader.
 *
 * @param count the number of simultaneous downloads, scope: [1, 12].
 * @return whether is successful to set the max network thread count.
 * If there are any actively executing tasks in FileDownloader, you will receive a warn
 * priority log int the logcat and this operation would be failed.
 */
public boolean setMaxNetworkThreadCount(final int count) {
    if (!FileDownloadList.getImpl().isEmpty()) {
        FileDownloadLog.w(this, "Can't change the max network thread count, because there " +
                "are actively executing tasks in FileDownloader, please try again after all" +
                " actively executing tasks are completed or invoking FileDownloader#pauseAll" +
                " directly.");
        return false;
    }

    return FileDownloadServiceProxy.getImpl().setMaxNetworkThreadCount(count);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:21,代码来源:FileDownloader.java

示例8: disconnected

import com.liulishuo.filedownloader.util.FileDownloadLog; //导入方法依赖的package包/类
@Override
public void disconnected() {

    if (getConnectStatus() == DownloadServiceConnectChangedEvent.ConnectStatus.lost) {

        final IQueuesHandler queueHandler = FileDownloader.getImpl().getQueuesHandler();
        // lost the connection to the service
        if (FileDownloadLog.NEED_LOG) {
            FileDownloadLog.d(this, "lost the connection to the " +
                            "file download service, and current active task size is %d",
                    FileDownloadList.getImpl().size());
        }

        if (FileDownloadList.getImpl().size() > 0) {
            synchronized (mWaitingList) {
                FileDownloadList.getImpl().divertAndIgnoreDuplicate(mWaitingList);
                for (BaseDownloadTask.IRunningTask task : mWaitingList) {
                    task.free();
                }

                queueHandler.freezeAllSerialQueues();
            }
            FileDownloader.getImpl().bindService();
        }
    } else {

        if (FileDownloadList.getImpl().size() > 0) {
            FileDownloadLog.w(this, "file download service has be unbound" +
                            " but the size of active tasks are not empty %d ",
                    FileDownloadList.getImpl().size());
        }
    }
}
 
开发者ID:yannanzheng,项目名称:FileDownloader-master,代码行数:34,代码来源:LostServiceConnectedHandler.java

示例9: IDownloadEvent

import com.liulishuo.filedownloader.util.FileDownloadLog; //导入方法依赖的package包/类
/**
 * @see #IDownloadEvent(String)
 * @deprecated do not handle ORDER any more.
 */
public IDownloadEvent(final String id, boolean order) {
    this.id = id;
    if (order) {
        FileDownloadLog.w(this, "do not handle ORDER any more, %s", id);
    }
}
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:11,代码来源:IDownloadEvent.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);
    } else {
        insert(downloadModel);
    }
}
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:16,代码来源:NoDatabaseImpl.java

示例11: renameTempFile

import com.liulishuo.filedownloader.util.FileDownloadLog; //导入方法依赖的package包/类
private void renameTempFile() throws IOException {
    final String tempPath = model.getTempFilePath();
    final String targetPath = model.getTargetFilePath();

    final File tempFile = new File(tempPath);
    try {
        final File targetFile = new File(targetPath);

        if (targetFile.exists()) {
            final long oldTargetFileLength = targetFile.length();
            if (!targetFile.delete()) {
                throw new IOException(FileDownloadUtils.formatString(
                        "Can't delete the old file([%s], [%d]), " +
                                "so can't replace it with the new downloaded one.",
                        targetPath, oldTargetFileLength
                ));
            } else {
                FileDownloadLog.w(this, "The target file([%s], [%d]) will be replaced with" +
                                " the new downloaded file[%d]",
                        targetPath, oldTargetFileLength, tempFile.length());
            }
        }

        if (!tempFile.renameTo(targetFile)) {
            throw new IOException(FileDownloadUtils.formatString(
                    "Can't rename the  temp downloaded file(%s) to the target file(%s)",
                    tempPath, targetPath
            ));
        }
    } finally {
        if (tempFile.exists()) {
            if (!tempFile.delete()) {
                FileDownloadLog.w(this,
                        "delete the temp file(%s) failed, on completed downloading.",
                        tempPath);
            }
        }
    }
}
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:40,代码来源:DownloadStatusCallback.java

示例12: clearTaskData

import com.liulishuo.filedownloader.util.FileDownloadLog; //导入方法依赖的package包/类
public boolean clearTaskData(int id) {
    if (id == 0) {
        FileDownloadLog.w(this, "The task[%d] id is invalid, can't clear it.", id);
        return false;
    }

    if (isDownloading(id)) {
        FileDownloadLog.w(this, "The task[%d] is downloading, can't clear it.", id);
        return false;
    }

    mDatabase.remove(id);
    mDatabase.removeConnections(id);
    return true;
}
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:16,代码来源:FileDownloadManager.java

示例13: intoLaunchPool

import com.liulishuo.filedownloader.util.FileDownloadLog; //导入方法依赖的package包/类
@Override
public void intoLaunchPool() {
    synchronized (mPauseLock) {
        if (mStatus != FileDownloadStatus.INVALID_STATUS) {
            FileDownloadLog.w(this, "High concurrent cause, this task %d will not input " +
                            "to launch pool, because of the status isn't idle : %d",
                    getId(), mStatus);
            return;
        }

        mStatus = FileDownloadStatus.toLaunchPool;
    }

    final BaseDownloadTask.IRunningTask runningTask = mTask.getRunningTask();
    final BaseDownloadTask origin = runningTask.getOrigin();

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

    if (FileDownloadLog.NEED_LOG) {
        FileDownloadLog.v(this, "call start " +
                        "Url[%s], Path[%s] Listener[%s], Tag[%s]",
                origin.getUrl(), origin.getPath(), origin.getListener(), origin.getTag());
    }

    boolean ready = true;

    try {
        prepare();
    } catch (Throwable e) {
        ready = false;

        FileDownloadList.getImpl().add(runningTask);
        FileDownloadList.getImpl().remove(runningTask, prepareErrorMessage(e));
    }

    if (ready) {
        FileDownloadTaskLauncher.getImpl().launch(this);
    }

    if (FileDownloadLog.NEED_LOG) {
        FileDownloadLog.v(this, "the task[%d] has been into the launch pool.", getId());
    }
}
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:46,代码来源:DownloadTaskHunter.java

示例14: run

import com.liulishuo.filedownloader.util.FileDownloadLog; //导入方法依赖的package包/类
@Override
public void run() {
    Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND);

    FileDownloadConnection connection = null;
    final long beginOffset = connectTask.getProfile().currentOffset;
    boolean isConnected = false;
    do {

        try {
            if (paused) {
                return;
            }

            isConnected = false;
            connection = connectTask.connect();
            final int code = connection.getResponseCode();

            if (FileDownloadLog.NEED_LOG) {
                FileDownloadLog.d(this, "the connection[%d] for %d, is connected %s with code[%d]",
                        connectionIndex, downloadId, connectTask.getProfile(), code);
            }

            if (code != HttpURLConnection.HTTP_PARTIAL && code != HttpURLConnection.HTTP_OK) {
                throw new SocketException(FileDownloadUtils.
                        formatString("Connection failed with request[%s] response[%s] http-state[%d] on task[%d-%d], " +
                                        "which is changed after verify connection, so please try again.",
                                connectTask.getRequestHeader(), connection.getResponseHeaderFields(),
                                code, downloadId, connectionIndex));
            }

            isConnected = true;
            final FetchDataTask.Builder builder = new FetchDataTask.Builder();

            if (paused) return;
            fetchDataTask = builder
                    .setDownloadId(downloadId)
                    .setConnectionIndex(connectionIndex)
                    .setCallback(callback)
                    .setHost(this)
                    .setWifiRequired(isWifiRequired)
                    .setConnection(connection)
                    .setConnectionProfile(this.connectTask.getProfile())
                    .setPath(path)
                    .build();


            fetchDataTask.run();
            if (paused){
                fetchDataTask.pause();
            }
            break;
        } catch (IllegalAccessException | IOException | FileDownloadGiveUpRetryException | IllegalArgumentException e) {
            if (callback.isRetry(e)) {
                if (!isConnected) {
                    callback.onRetry(e, 0);
                } else if (fetchDataTask != null) {
                    // connected
                    final long invalidIncreaseBytes = fetchDataTask.currentOffset - beginOffset;
                    callback.onRetry(e, invalidIncreaseBytes);
                } else {
                    // connected but create fetch data task failed, give up directly.
                    FileDownloadLog.w(this, "it is valid to retry and connection is valid but" +
                            " create fetch-data-task failed, so give up directly with %s", e);
                    callback.onError(e);
                    break;
                }

            } else {
                callback.onError(e);
                break;
            }

        } finally {
            if (connection != null) connection.ending();
        }
    } while (true);

}
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:80,代码来源:DownloadRunnable.java

示例15: setTaskCompleted

import com.liulishuo.filedownloader.util.FileDownloadLog; //导入方法依赖的package包/类
/**
 * @param url        The url of the completed task.
 * @param path       The absolute path of the completed task's save file.
 * @param totalBytes The content-length of the completed task, the length of the file in the
 *                   {@code path} must be equal to this value.
 * @return Whether is successful to set the task completed. If the {@code path} not exist will be
 * false; If the length of the file in {@code path} is not equal to {@code totalBytes} will be
 * false; If the task with {@code url} and {@code path} is downloading will be false. Otherwise
 * will be true.
 * @see FileDownloadUtils#isFilenameConverted(Context)
 * <p>
 * <p/>
 * Recommend used to telling the FileDownloader Engine that the task with the {@code url}  and
 * the {@code path} has already completed downloading, in case of your task has already
 * downloaded by other ways(not by FileDownloader Engine), and after success to set the task
 * completed, FileDownloader will check the task with {@code url} and the {@code path} whether
 * completed by {@code totalBytes}.
 * <p/>
 * Otherwise, If FileDownloader Engine isn't know your task's status, whatever your task with
 * the {@code url} and the {@code path} has already downloaded in other way, FileDownloader
 * Engine will ignore the exist file and redownload it, because FileDownloader Engine don't know
 * the exist file whether it is valid.
 * @see #setTaskCompleted(List)
 * @deprecated If you invoked this method, please remove the code directly feel free, it doesn't
 * need any longer. In new mechanism(filedownloader 0.3.3 or higher), FileDownloader doesn't store
 * completed tasks in Database anymore, because all downloading files have temp a file name.
 */
@SuppressWarnings("UnusedParameters")
public boolean setTaskCompleted(String url, String path, long totalBytes) {
    FileDownloadLog.w(this, "If you invoked this method, please remove it directly feel free, " +
            "it doesn't need any longer");
    return true;
}
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:34,代码来源:FileDownloader.java


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