public static Observable<byte[]> downloadFileAsync(String url, Retrofit retrofit) {
        FileService service = retrofit.create(FileService.class);
        Observable<ResponseBody> response = service.download(url);
        return response.map(new Func1<ResponseBody, byte[]>() {
            @Override
            public byte[] call(ResponseBody responseBody) {
                try {
                    return responseBody.bytes();
                } catch (IOException e) {
                    throw Exceptions.propagate(e);
                }
            }
        });
    }
public static Observable < byte [ ] > downloadFileAsync ( String url , Retrofit retrofit ) { FileService service = retrofit . create ( FileService . class ) ; Observable < ResponseBody > response = service . download ( url ) ; return response . map ( new Func1 < ResponseBody , byte [ ] > ( ) { @ Override public byte [ ] call ( ResponseBody responseBody ) { try { return responseBody . bytes ( ) ; } catch ( IOException e ) { throw Exceptions . propagate ( e ) ; } } } ) ; }
Download a file asynchronously.
@param url the URL pointing to the file
@param retrofit the retrofit client
@return an Observable pointing to the content of the file