类com.bumptech.glide.load.HttpException源码实例Demo

下面列出了怎么用com.bumptech.glide.load.HttpException的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: AndroidProject   文件: OkHttpFetcher.java
@Override
public void onResponse(@NonNull Call call, @NonNull Response response) {
    mResponseBody = response.body();
    if (response.isSuccessful()) {
        long contentLength = Preconditions.checkNotNull(mResponseBody).contentLength();
        mInputStream = ContentLengthInputStream.obtain(mResponseBody.byteStream(), contentLength);
        mDataCallback.onDataReady(mInputStream);
    } else {
        mDataCallback.onLoadFailed(new HttpException(response.message(), response.code()));
    }
}
 
源代码2 项目: FastAndroid   文件: OkHttpStreamFetcher.java
@Override
public void onResponse(Call call, Response response) throws IOException {
    responseBody = response.body();
    if (response.isSuccessful()) {
        long contentLength = responseBody.contentLength();
        stream = ContentLengthInputStream.obtain(responseBody.byteStream(), contentLength);
        callback.onDataReady(stream);
    } else {
        callback.onLoadFailed(new HttpException(response.message(), response.code()));
    }
}
 
源代码3 项目: Aurora   文件: OkHttpStreamFetcher.java
@Override
public void onResponse(Call call, Response response) throws IOException {
    responseBody = response.body();
    if (response.isSuccessful()) {
        long contentLength = responseBody.contentLength();
        stream = ContentLengthInputStream.obtain(responseBody.byteStream(), contentLength);
        callback.onDataReady(stream);
    } else {
        callback.onLoadFailed(new HttpException(response.message(), response.code()));
    }
}
 
源代码4 项目: MVVMArms   文件: OkHttpStreamFetcher.java
@Override
public void onResponse(@NonNull Call call, @NonNull Response response) throws IOException {
    responseBody = response.body();
    if (response.isSuccessful()) {
        long contentLength = responseBody.contentLength();
        stream = ContentLengthInputStream.obtain(responseBody.byteStream(), contentLength);
        callback.onDataReady(stream);
    } else {
        callback.onLoadFailed(new HttpException(response.message(), response.code()));
    }
}
 
源代码5 项目: pandroid   文件: OkHttpStreamFetcher.java
@Override
public void onResponse(@NonNull Call call, @NonNull Response response) {
  responseBody = response.body();
  if (response.isSuccessful()) {
    long contentLength = Preconditions.checkNotNull(responseBody).contentLength();
    stream = ContentLengthInputStream.obtain(responseBody.byteStream(), contentLength);
    callback.onDataReady(stream);
  } else {
    callback.onLoadFailed(new HttpException(response.message(), response.code()));
  }
}
 
源代码6 项目: MVPArms   文件: OkHttpStreamFetcher.java
@Override
public void onResponse(@NonNull Call call, @NonNull Response response) {
    responseBody = response.body();
    if (response.isSuccessful()) {
        long contentLength = Preconditions.checkNotNull(responseBody).contentLength();
        stream = ContentLengthInputStream.obtain(responseBody.byteStream(), contentLength);
        callback.onDataReady(stream);
    } else {
        callback.onLoadFailed(new HttpException(response.message(), response.code()));
    }
}
 
源代码7 项目: nextcloud-notes   文件: Capabilities.java
public Capabilities(@NonNull String response, @Nullable String eTag) throws NextcloudHttpRequestFailedException {
    this.eTag = eTag;
    final JSONObject ocs;
    try {
        ocs = new JSONObject(response).getJSONObject(JSON_OCS);
        if (ocs.has(JSON_OCS_META)) {
            final JSONObject meta = ocs.getJSONObject(JSON_OCS_META);
            if (meta.has(JSON_OCS_META_STATUSCODE)) {
                if (meta.getInt(JSON_OCS_META_STATUSCODE) == HTTP_UNAVAILABLE) {
                    Log.i(TAG, "Capabilities Endpoint: This instance is currently in maintenance mode.");
                    throw new NextcloudHttpRequestFailedException(HTTP_UNAVAILABLE, new HttpException(HTTP_UNAVAILABLE));
                }
            }
        }
        if (ocs.has(JSON_OCS_DATA)) {
            final JSONObject data = ocs.getJSONObject(JSON_OCS_DATA);
            if (data.has(JSON_OCS_DATA_CAPABILITIES)) {
                final JSONObject capabilities = data.getJSONObject(JSON_OCS_DATA_CAPABILITIES);
                if (capabilities.has(JSON_OCS_DATA_CAPABILITIES_NOTES)) {
                    final JSONObject notes = capabilities.getJSONObject(JSON_OCS_DATA_CAPABILITIES_NOTES);
                    if (notes.has(JSON_OCS_DATA_CAPABILITIES_NOTES_API_VERSION)) {
                        this.apiVersion = notes.getString(JSON_OCS_DATA_CAPABILITIES_NOTES_API_VERSION);
                    }
                }
                if (capabilities.has(JSON_OCS_DATA_CAPABILITIES_THEMING)) {
                    final JSONObject theming = capabilities.getJSONObject(JSON_OCS_DATA_CAPABILITIES_THEMING);
                    if (theming.has(JSON_OCS_DATA_CAPABILITIES_THEMING_COLOR)) {
                        this.color = theming.getString(JSON_OCS_DATA_CAPABILITIES_THEMING_COLOR);
                    }
                    if (theming.has(JSON_OCS_DATA_CAPABILITIES_THEMING_COLOR_TEXT)) {
                        this.textColor = theming.getString(JSON_OCS_DATA_CAPABILITIES_THEMING_COLOR_TEXT);
                    }
                }
            }
        }
    } catch (JSONException e) {
        e.printStackTrace();
    }
}
 
 类所在包
 同包方法