我从服务器获取tar.gz文件。使用改造我使用Charles代理检查了响应。现在,如何将响应存储在内部存储中并读取文件内容? tar.gz文件包含PNG文件。下面是我从服务器获得响应的代码片段。
OkHttpClient.Builder builder = new OkHttpClient.Builder();
builder.connectTimeout(60, TimeUnit.SECONDS);
Retrofit retrofit = new Retrofit.Builder()
.client(builder.build())
.addConverterFactory(GsonConverterFactory.create())
.addCallAdapterFactory(RxJavaCallAdapterFactory.create())
.baseUrl("http://www.labox.com/")
.build();
HttpService downloadService = retrofit.create(HttpService.class);
downloadService.downloadChannelLogoZipFile(URI)
.flatMap(new Func1<Response<ResponseBody>, Observable<File>>() {
@Override
public Observable<File> call(final Response<ResponseBody> responseBodyResponse) {
return Observable.create(new Observable.OnSubscribe<File>() {
@Override
public void call(Subscriber<? super File> subscriber) {
try {
....}