花瓣 v4.6.12版本的 MD5 值为:6a3515d4d16d98931f1b3d25a91b257e
以下内容为反编译后的 z.java 源代码,内容仅作参考
package com.gaoding.foundations.sdk.http;
import androidx.annotation.Nullable;
import com.baidu.mobads.sdk.internal.bq;
import okhttp3.Headers;
import okhttp3.Protocol;
import okhttp3.Request;
import okhttp3.Response;
import okhttp3.ResponseBody;
public final class z<T> {
private final Response a;
@Nullable
private final T b;
@Nullable
private final ResponseBody c;
private z(Response response, @Nullable T t, @Nullable ResponseBody responseBody) {
this.a = response;
this.b = t;
this.c = responseBody;
}
public static <T> z<T> c(int i2, ResponseBody responseBody) {
if (i2 >= 400) {
return d(responseBody, new Response.Builder().code(i2).message("Response.error()").protocol(Protocol.HTTP_1_1).request(new Request.Builder().url("http://localhost/").build()).build());
}
throw new IllegalArgumentException("code < 400: " + i2);
}
public static <T> z<T> d(ResponseBody responseBody, Response response) {
c0.b(responseBody, "body == null");
c0.b(response, "rawResponse == null");
if (!response.isSuccessful()) {
return new z<>(response, null, responseBody);
}
throw new IllegalArgumentException("rawResponse should not be successful response");
}
public static <T> z<T> j(int i2, @Nullable T t) {
if (i2 >= 200 && i2 < 300) {
return m(t, new Response.Builder().code(i2).message("Response.success()").protocol(Protocol.HTTP_1_1).request(new Request.Builder().url("http://localhost/").build()).build());
}
throw new IllegalArgumentException("code < 200 or >= 300: " + i2);
}
public static <T> z<T> k(@Nullable T t) {
return m(t, new Response.Builder().code(200).message(bq.k).protocol(Protocol.HTTP_1_1).request(new Request.Builder().url("http://localhost/").build()).build());
}
public static <T> z<T> l(@Nullable T t, Headers headers) {
c0.b(headers, "headers == null");
return m(t, new Response.Builder().code(200).message(bq.k).protocol(Protocol.HTTP_1_1).headers(headers).request(new Request.Builder().url("http://localhost/").build()).build());
}
public static <T> z<T> m(@Nullable T t, Response response) {
c0.b(response, "rawResponse == null");
if (response.isSuccessful()) {
return new z<>(response, t, null);
}
throw new IllegalArgumentException("rawResponse must be successful response");
}
@Nullable
public T a() {
return this.b;
}
public int b() {
return this.a.code();
}
@Nullable
public ResponseBody e() {
return this.c;
}
public Headers f() {
return this.a.headers();
}
public boolean g() {
return this.a.isSuccessful();
}
public String h() {
return this.a.message();
}
public Response i() {
return this.a;
}
public String toString() {
return this.a.toString();
}
}