com.bumptech.glide.util.Preconditions Java Examples

The following examples show how to use com.bumptech.glide.util.Preconditions. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: OkHttpFetcher.java    From AndroidProject with Apache License 2.0 5 votes vote down vote up
@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()));
    }
}
 
Example #2
Source File: OkHttpStreamFetcher.java    From pandroid with Apache License 2.0 5 votes vote down vote up
@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()));
  }
}
 
Example #3
Source File: OkHttpStreamFetcher.java    From MVPArms with Apache License 2.0 5 votes vote down vote up
@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()));
    }
}