
com.bumptech.glide.load.model.ByteBufferEncoder 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.
package com.bumptech.glide.load.model;
import android.util.Log;
import com.bumptech.glide.load.Encoder;
import com.bumptech.glide.load.Options;
import com.bumptech.glide.util.ByteBufferUtil;
import java.io.File;
import java.io.IOException;
import java.nio.ByteBuffer;
/**
* Writes {@link ByteBuffer ByteBuffers} to {@link File Files}.
*/
public class ByteBufferEncoder implements Encoder {
private static final String TAG = "ByteBufferEncoder";
@Override
public boolean encode(ByteBuffer data, File file, Options options) {
boolean success = false;
try {
ByteBufferUtil.toFile(data, file);
success = true;
} catch (IOException e) {
if (Log.isLoggable(TAG, Log.DEBUG)) {
Log.d(TAG, "Failed to write data", e);
}
}
return success;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy