Example usage for org.apache.http.util EntityUtilsHC4 consume

List of usage examples for org.apache.http.util EntityUtilsHC4 consume

Introduction

In this page you can find the example usage for org.apache.http.util EntityUtilsHC4 consume.

Prototype

public static void consume(final HttpEntity entity) throws IOException 

Source Link

Document

Ensures that the entity content is fully consumed and the content stream, if exists, is closed.

Usage

From source file:nya.miku.wishmaster.http.streamer.HttpResponseModel.java

/** ??  ? ?? ??   HTTP-?  HTTP- */
static void release(HttpUriRequest request, HttpResponse response) {
    try {/*from   w w  w .j  a v a  2 s. c o m*/
        if (request != null)
            request.abort();
    } catch (Exception e) {
        Logger.e(TAG, e);
    }
    try {
        if (response != null) {
            HttpEntity entity = response.getEntity();
            EntityUtilsHC4.consume(entity);
        }
    } catch (Exception e) {
        Logger.e(TAG, e);
    }
    try {
        if (response != null && response instanceof Closeable)
            ((Closeable) response).close();
    } catch (Exception e) {
        Logger.e(TAG, e);
    }
}