Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.koushikdutta.ion.loader;
 
 import  android.text.TextUtils;
 
Created by koush on 5/22/13.
public class HttpLoader extends SimpleLoader {
    @SuppressWarnings("unchecked")
    @Override
    public Future<DataEmitterload(Ion ionAsyncHttpRequest requestfinal FutureCallback<LoaderEmittercallback) {
        if (!request.getUri().getScheme().startsWith("http"))
            return null;
        return (FutureDataEmitter >)(Future)ion.getHttpClient().execute(requestnew HttpConnectCallback() {
            @Override
            public void onConnectCompleted(Exception exAsyncHttpResponse response) {
                long length = -1;
                ResponseServedFrom loadedFrom = .;
                HeadersResponse headers = null;
                AsyncHttpRequest request = null;
                if (response != null) {
                    request = response.getRequest();
                    headers = new HeadersResponse(response.code(), response.message(), response.headers());
                    length = HttpUtil.contentLength(headers.getHeaders());
                    String servedFrom = response.headers().get(.);
                    if (TextUtils.equals(servedFrom.))
                        loadedFrom = .;
                    else if (TextUtils.equals(servedFrom.))
                        loadedFrom = .;
                }
                callback.onCompleted(ex,
                    new LoaderEmitter(responselengthloadedFromheadersrequest));
            }
        });
    }
New to GrepCode? Check out our FAQ X