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;
                int loadedFrom = .;
                RawHeaders headers = null;
                AsyncHttpRequest request = null;
                if (response != null) {
                    request = response.getRequest();
                    headers = response.getHeaders().getHeaders();
                    length = response.getHeaders().getContentLength();
                    String servedFrom = response.getHeaders().getHeaders().get(.);
                    if (TextUtils.equals(servedFrom.))
                        loadedFrom = .;
                    else if (TextUtils.equals(servedFrom.))
                        loadedFrom = .;
                }
                callback.onCompleted(exnew LoaderEmitter(responselengthloadedFromheadersrequest));
            }
        });
    }
New to GrepCode? Check out our FAQ X