![JAR search and dependency download from the Maven repository](/logo.png)
com.bumptech.glide.load.resource.bitmap.InputStreamBitmapImageDecoderResourceDecoder 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.resource.bitmap;
import android.graphics.Bitmap;
import android.graphics.ImageDecoder;
import android.graphics.ImageDecoder.Source;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import com.bumptech.glide.load.Options;
import com.bumptech.glide.load.ResourceDecoder;
import com.bumptech.glide.load.engine.Resource;
import com.bumptech.glide.util.ByteBufferUtil;
import java.io.IOException;
import java.io.InputStream;
import java.nio.ByteBuffer;
/** {@link InputStream} specific implementation of {@link BitmapImageDecoderResourceDecoder}. */
@RequiresApi(api = 28)
public final class InputStreamBitmapImageDecoderResourceDecoder
implements ResourceDecoder {
private final BitmapImageDecoderResourceDecoder wrapped = new BitmapImageDecoderResourceDecoder();
@Override
public boolean handles(@NonNull InputStream source, @NonNull Options options) throws IOException {
return true;
}
@Override
public Resource decode(
@NonNull InputStream stream, int width, int height, @NonNull Options options)
throws IOException {
ByteBuffer buffer = ByteBufferUtil.fromStream(stream);
Source source = ImageDecoder.createSource(buffer);
return wrapped.decode(source, width, height, options);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy