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


Java Constants.LOGV属性代码示例

本文整理汇总了Java中com.google.android.vending.expansion.downloader.Constants.LOGV属性的典型用法代码示例。如果您正苦于以下问题:Java Constants.LOGV属性的具体用法?Java Constants.LOGV怎么用?Java Constants.LOGV使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.google.android.vending.expansion.downloader.Constants的用法示例。


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

示例1: scheduleAlarm

private void scheduleAlarm(long wakeUp) {
    AlarmManager alarms = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
    if (alarms == null) {
        Log.e(Constants.TAG, "couldn't get alarm manager");
        return;
    }

    if (Constants.LOGV) {
        Log.v(Constants.TAG, "scheduling retry in " + wakeUp + "ms");
    }

    String className = getAlarmReceiverClassName();
    Intent intent = new Intent(Constants.ACTION_RETRY);
    intent.putExtra(EXTRA_PENDING_INTENT, mPendingIntent);
    intent.setClassName(this.getPackageName(),
            className);
    mAlarmIntent = PendingIntent.getBroadcast(this, 0, intent,
            PendingIntent.FLAG_ONE_SHOT);
    alarms.set(
            AlarmManager.RTC_WAKEUP,
            System.currentTimeMillis() + wakeUp, mAlarmIntent
            );
}
 
开发者ID:snoozinsquatch,项目名称:unity-obb-downloader,代码行数:23,代码来源:DownloaderService.java

示例2: executeDownload

/**
 * Fully execute a single download request - setup and send the request,
 * handle the response, and transfer the data to the destination file.
 */
private void executeDownload(State state, HttpURLConnection request)
        throws StopRequest, RetryDownload {
    InnerState innerState = new InnerState();
    byte data[] = new byte[Constants.BUFFER_SIZE];

    checkPausedOrCanceled(state);

    setupDestinationFile(state, innerState);
    addRequestHeaders(innerState, request);

    // check just before sending the request to avoid using an invalid
    // connection at all
    checkConnectivity(state);

    mNotification.onDownloadStateChanged(IDownloaderClient.STATE_CONNECTING);
    int responseCode = sendRequest(state, request);
    handleExceptionalStatus(state, innerState, request, responseCode);

    if (Constants.LOGV) {
        Log.v(Constants.TAG, "received response for " + mInfo.mUri);
    }

    processResponseHeaders(state, innerState, request);
    InputStream entityStream = openResponseEntity(state, request);
    mNotification.onDownloadStateChanged(IDownloaderClient.STATE_DOWNLOADING);
    transferData(state, innerState, data, entityStream);
}
 
开发者ID:snoozinsquatch,项目名称:unity-obb-downloader,代码行数:31,代码来源:DownloadThread.java

示例3: closeDestination

/**
 * Close the destination output stream.
 */
private void closeDestination(State state) {
    try {
        // close the file
        if (state.mStream != null) {
            state.mStream.close();
            state.mStream = null;
        }
    } catch (IOException ex) {
        if (Constants.LOGV) {
            Log.v(Constants.TAG, "exception when closing the file after download : " + ex);
        }
        // nothing can really be done if the file can't be closed
    }
}
 
开发者ID:snoozinsquatch,项目名称:unity-obb-downloader,代码行数:17,代码来源:DownloadThread.java

示例4: executeDownload

/**
 * Fully execute a single download request - setup and send the request,
 * handle the response, and transfer the data to the destination file.
 */
private void executeDownload(State state, AndroidHttpClient client, HttpGet request)
        throws StopRequest, RetryDownload {
    InnerState innerState = new InnerState();
    byte data[] = new byte[Constants.BUFFER_SIZE];

    checkPausedOrCanceled(state);

    setupDestinationFile(state, innerState);
    addRequestHeaders(innerState, request);

    // check just before sending the request to avoid using an invalid
    // connection at all
    checkConnectivity(state);

    mNotification.onDownloadStateChanged(IDownloaderClient.STATE_CONNECTING);
    HttpResponse response = sendRequest(state, client, request);
    handleExceptionalStatus(state, innerState, response);

    if (Constants.LOGV) {
        Log.v(Constants.TAG, "received response for " + mInfo.mUri);
    }

    processResponseHeaders(state, innerState, response);
    InputStream entityStream = openResponseEntity(state, response);
    mNotification.onDownloadStateChanged(IDownloaderClient.STATE_DOWNLOADING);
    transferData(state, innerState, data, entityStream);
}
 
开发者ID:SlotNSlot,项目名称:SlotNSlot_Android,代码行数:31,代码来源:DownloadThread.java

示例5: handleRedirect

/**
 * Handle a 3xx redirect status.
 */
private void handleRedirect(State state, HttpResponse response, int statusCode)
        throws StopRequest, RetryDownload {
    if (Constants.LOGVV) {
        Log.v(Constants.TAG, "got HTTP redirect " + statusCode);
    }
    if (state.mRedirectCount >= Constants.MAX_REDIRECTS) {
        throw new StopRequest(DownloaderService.STATUS_TOO_MANY_REDIRECTS, "too many redirects");
    }
    Header header = response.getFirstHeader("Location");
    if (header == null) {
        return;
    }
    if (Constants.LOGVV) {
        Log.v(Constants.TAG, "Location :" + header.getValue());
    }

    String newUri;
    try {
        newUri = new URI(mInfo.mUri).resolve(new URI(header.getValue())).toString();
    } catch (URISyntaxException ex) {
        if (Constants.LOGV) {
            Log.d(Constants.TAG, "Couldn't resolve redirect URI " + header.getValue()
                    + " for " + mInfo.mUri);
        }
        throw new StopRequest(DownloaderService.STATUS_HTTP_DATA_ERROR,
                "Couldn't resolve redirect URI");
    }
    ++state.mRedirectCount;
    state.mRequestUri = newUri;
    if (statusCode == 301 || statusCode == 303) {
        // use the new URI for all future requests (should a retry/resume be
        // necessary)
        state.mNewUri = newUri;
    }
    throw new RetryDownload();
}
 
开发者ID:SlotNSlot,项目名称:SlotNSlot_Android,代码行数:39,代码来源:DownloadThread.java

示例6: handleRedirect

/**
 * Handle a 3xx redirect status.
 */
private void handleRedirect(State state, HttpResponse response, int statusCode)
        throws StopRequest, RetryDownload {
    if (Constants.LOGVV) {
        Log.v(Constants.TAG, "got HTTP redirect " + statusCode);
    }
    if (state.mRedirectCount >= Constants.MAX_REDIRECTS) {
        throw new StopRequest(DownloaderService.STATUS_TOO_MANY_REDIRECTS, "too many redirects");
    }
    Header header = response.getFirstHeader("Location");
    if (header == null) {
        return;
    }
    if (Constants.LOGVV) {
        Log.v(Constants.TAG, "Location :" + header.getValue());
    }

    String newUri;
    try {
        newUri = new URI(mInfo.mUri).resolve(new URI(header.getValue())).toString();
    } catch (URISyntaxException ex) {
        if (Constants.LOGV) {
            Log.d(Constants.TAG, "Couldn't resolve redirect URI " + header.getValue()
                    + " for " + mInfo.mUri);
        }
        throw new StopRequest(DownloaderService.STATUS_HTTP_DATA_ERROR,
                "Couldn't resolve redirect URI");
    }
    ++state.mRedirectCount;
    state.mRequestUri = newUri;
    throw new RetryDownload();
}
 
开发者ID:CmdrStardust,项目名称:Alite,代码行数:34,代码来源:DownloadThread.java

示例7: run

/**
 * Executes the download in a separate thread
 */
public void run() {
    Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND);

    State state = new State(mInfo, mService);
    PowerManager.WakeLock wakeLock = null;
    int finalStatus = DownloaderService.STATUS_UNKNOWN_ERROR;

    try {
        PowerManager pm = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);
        wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, Constants.TAG);
        wakeLock.acquire();

        if (Constants.LOGV) {
            Log.v(Constants.TAG, "initiating download for " + mInfo.mFileName);
            Log.v(Constants.TAG, "  at " + mInfo.mUri);
        }

        boolean finished = false;
        while (!finished) {
            if (Constants.LOGV) {
                Log.v(Constants.TAG, "initiating download for " + mInfo.mFileName);
                Log.v(Constants.TAG, "  at " + mInfo.mUri);
            }
            // Set or unset proxy, which may have changed since last GET
            // request.
            // setDefaultProxy() supports null as proxy parameter.
            URL url = new URL(state.mRequestUri);
            HttpURLConnection request = (HttpURLConnection)url.openConnection();
            request.setRequestProperty("User-Agent", userAgent());
            try {
                executeDownload(state, request);
                finished = true;
            } catch (RetryDownload exc) {
                // fall through
            } finally {
                request.disconnect();
                request = null;
            }
        }

        if (Constants.LOGV) {
            Log.v(Constants.TAG, "download completed for " + mInfo.mFileName);
            Log.v(Constants.TAG, "  at " + mInfo.mUri);
        }
        finalizeDestinationFile(state);
        finalStatus = DownloaderService.STATUS_SUCCESS;
    } catch (StopRequest error) {
        // remove the cause before printing, in case it contains PII
        Log.w(Constants.TAG,
                "Aborting request for download " + mInfo.mFileName + ": " + error.getMessage());
        error.printStackTrace();
        finalStatus = error.mFinalStatus;
        // fall through to finally block
    } catch (Throwable ex) { // sometimes the socket code throws unchecked
                             // exceptions
        Log.w(Constants.TAG, "Exception for " + mInfo.mFileName + ": " + ex);
        finalStatus = DownloaderService.STATUS_UNKNOWN_ERROR;
        // falls through to the code that reports an error
    } finally {
        if (wakeLock != null) {
            wakeLock.release();
            wakeLock = null;
        }
        cleanupDestination(state, finalStatus);
        notifyDownloadCompleted(finalStatus, state.mCountRetry, state.mRetryAfter,
                state.mRedirectCount, state.mGotData, state.mFilename);
    }
}
 
开发者ID:snoozinsquatch,项目名称:unity-obb-downloader,代码行数:71,代码来源:DownloadThread.java

示例8: run

/**
 * Executes the download in a separate thread
 */
public void run() {
    Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND);

    State state = new State(mInfo, mService);
    AndroidHttpClient client = null;
    PowerManager.WakeLock wakeLock = null;
    int finalStatus = DownloaderService.STATUS_UNKNOWN_ERROR;

    try {
        PowerManager pm = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);
        wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, Constants.TAG);
        wakeLock.acquire();

        if (Constants.LOGV) {
            Log.v(Constants.TAG, "initiating download for " + mInfo.mFileName);
            Log.v(Constants.TAG, "  at " + mInfo.mUri);
        }

        client = AndroidHttpClient.newInstance(userAgent(), mContext);

        boolean finished = false;
        while (!finished) {
            if (Constants.LOGV) {
                Log.v(Constants.TAG, "initiating download for " + mInfo.mFileName);
                Log.v(Constants.TAG, "  at " + mInfo.mUri);
            }
            // Set or unset proxy, which may have changed since last GET
            // request.
            // setDefaultProxy() supports null as proxy parameter.
            ConnRouteParams.setDefaultProxy(client.getParams(),
                    getPreferredHttpHost(mContext, state.mRequestUri));
            HttpGet request = new HttpGet(state.mRequestUri);
            try {
                executeDownload(state, client, request);
                finished = true;
            } catch (RetryDownload exc) {
                // fall through
            } finally {
                request.abort();
                request = null;
            }
        }

        if (Constants.LOGV) {
            Log.v(Constants.TAG, "download completed for " + mInfo.mFileName);
            Log.v(Constants.TAG, "  at " + mInfo.mUri);
        }
        finalizeDestinationFile(state);
        finalStatus = DownloaderService.STATUS_SUCCESS;
    } catch (StopRequest error) {
        // remove the cause before printing, in case it contains PII
        Log.w(Constants.TAG,
                "Aborting request for download " + mInfo.mFileName + ": " + error.getMessage());
        error.printStackTrace();
        finalStatus = error.mFinalStatus;
        // fall through to finally block
    } catch (Throwable ex) { // sometimes the socket code throws unchecked
                             // exceptions
        Log.w(Constants.TAG, "Exception for " + mInfo.mFileName + ": " + ex);
        finalStatus = DownloaderService.STATUS_UNKNOWN_ERROR;
        // falls through to the code that reports an error
    } finally {
        if (wakeLock != null) {
            wakeLock.release();
            wakeLock = null;
        }
        if (client != null) {
            client.close();
            client = null;
        }
        cleanupDestination(state, finalStatus);
        notifyDownloadCompleted(finalStatus, state.mCountRetry, state.mRetryAfter,
                state.mRedirectCount, state.mGotData, state.mFilename);
    }
}
 
开发者ID:SlotNSlot,项目名称:SlotNSlot_Android,代码行数:78,代码来源:DownloadThread.java

示例9: run

/**
    * Executes the download in a separate thread
    */
   @SuppressLint("Wakelock")
public void run() {
       Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND);

       State state = new State(mInfo, mService);
       AndroidHttpClient client = null;
       PowerManager.WakeLock wakeLock = null;
       int finalStatus = DownloaderService.STATUS_UNKNOWN_ERROR;

       try {
           PowerManager pm = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);
           wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, Constants.TAG);
           wakeLock.acquire();

           if (Constants.LOGV) {
               Log.v(Constants.TAG, "initiating download for " + mInfo.mFileName);
               Log.v(Constants.TAG, "  at " + mInfo.mUri);
           }

           client = AndroidHttpClient.newInstance(userAgent(), mContext);

           boolean finished = false;
           while (!finished) {
               if (Constants.LOGV) {
                   Log.v(Constants.TAG, "initiating download for " + mInfo.mFileName);
                   Log.v(Constants.TAG, "  at " + mInfo.mUri);
               }
               // Set or unset proxy, which may have changed since last GET
               // request.
               // setDefaultProxy() supports null as proxy parameter.
               ConnRouteParams.setDefaultProxy(client.getParams(),
                       getPreferredHttpHost(mContext, state.mRequestUri));
               HttpGet request = new HttpGet(state.mRequestUri);
               try {
                   executeDownload(state, client, request);
                   finished = true;
               } catch (RetryDownload exc) {
                   // fall through
               } finally {
                   request.abort();
                   request = null;
               }
           }

           if (Constants.LOGV) {
               Log.v(Constants.TAG, "download completed for " + mInfo.mFileName);
               Log.v(Constants.TAG, "  at " + mInfo.mUri);
           }
           finalizeDestinationFile(state);
           finalStatus = DownloaderService.STATUS_SUCCESS;
       } catch (StopRequest error) {
           // remove the cause before printing, in case it contains PII
           Log.w(Constants.TAG,
                   "Aborting request for download " + mInfo.mFileName + ": " + error.getMessage());
           error.printStackTrace();
           finalStatus = error.mFinalStatus;
           // fall through to finally block
       } catch (Throwable ex) { // sometimes the socket code throws unchecked
                                // exceptions
           Log.w(Constants.TAG, "Exception for " + mInfo.mFileName + ": " + ex);
           finalStatus = DownloaderService.STATUS_UNKNOWN_ERROR;
           // falls through to the code that reports an error
       } finally {
           if (wakeLock != null) {
               wakeLock.release();
               wakeLock = null;
           }
           if (client != null) {
               client.close();
               client = null;
           }
           cleanupDestination(state, finalStatus);
           notifyDownloadCompleted(finalStatus, state.mCountRetry, state.mRetryAfter,
                   state.mRedirectCount, state.mGotData, state.mFilename);
       }
   }
 
开发者ID:CmdrStardust,项目名称:Alite,代码行数:79,代码来源:DownloadThread.java


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