com.bumptech.glide.load.engine.DataCacheWriter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of glide Show documentation
Show all versions of glide Show documentation
A fast and efficient image loading library for Android focused on smooth scrolling.
The newest version!
package com.bumptech.glide.load.engine;
import androidx.annotation.NonNull;
import com.bumptech.glide.load.Encoder;
import com.bumptech.glide.load.Options;
import com.bumptech.glide.load.engine.cache.DiskCache;
import java.io.File;
/**
* Writes original source data or downsampled/transformed resource data to cache using the provided
* {@link com.bumptech.glide.load.Encoder} or {@link com.bumptech.glide.load.ResourceEncoder} and
* the given data or {@link com.bumptech.glide.load.engine.Resource}.
*
* @param The type of data that will be encoded (InputStream, ByteBuffer,
* Resource etc).
*/
class DataCacheWriter implements DiskCache.Writer {
private final Encoder encoder;
private final DataType data;
private final Options options;
DataCacheWriter(Encoder encoder, DataType data, Options options) {
this.encoder = encoder;
this.data = data;
this.options = options;
}
@Override
public boolean write(@NonNull File file) {
return encoder.encode(data, file, options);
}
}